-
Set your Heroku app's buildpack URL to
https://github.com/appstack/heroku-buildpack-nodejs-gulp.git. To be safe, you should really fork this and use your fork's URL. -
Run
heroku config:set NODE_ENV=productionto set your environment toproduction(or any other name) -
Add a Gulp task called
heroku:<NODE_ENV>that builds your app. For instance, if you followed the line above and set NODE_ENV to production, the name of this task would beheroku:production -
Add a single line
Procfileto the root to serve your app via node. This example assumes that you have aweb.jsfile in the root of your project:
web: node web.js
When the buildpack runs it will do many things similarly to the standard Heroku buildpack. In addition it will do the following things, not exactly in this order.
- If
gulpfile.jsis found- Run
npm update gulpto install gulp locally during the build - Run
gulp heroku:${NODE_ENV}to build the app
- Run
- If
bower.jsonis found- Extract the
directorykey from.bowerrcif that is present - Run
npm update bowerto install bower locally - Run
bower installto installbower_components. - Cache
bower_componentsor whichever alternate directory was specified in.bowerrc
- Extract the
The bower component caching is very similar to the node_modules caching done for npm. The cache is restored before each build and bower prune is run to remove anything no longer needed before doing the bower install. This is the same way the standard buildpack handles caching.
Inspired by Deploying a Yeoman/Angular app to Heroku.
Forked from heroku-buildpack-nodejs-gulp.
Which was forked from heroku-buildpack-nodejs.
Heavily based on heroku-buildpack-nodejs-grunt.