This is a Heroku buildpack for your grunt based web application located in
a client directory of your project. It installs npm and bower dependencies, runs grunt and supports compass.
The buildpack runs if it finds a client directory containing a gruntfile (grunt.js, Gruntfile.js or Gruntfile.coffee).
Your gruntfile must provide a build task and build the client into a client/dist folder.
Your server buildpack can then collect and serve the assets from client/dist. Everything except client/dist will be removed after build to reduce
the slug size.
You can configure your client directory and dist subdirectory with a .client file:
$ cat .client
CLIENT_DIR=myclient
DIST_DIR=mydist
This is not a standalone buildpack. It builds the client part of your web application and should be used together with other buildpacks like heroku-buildpack-ruby or heroku-buildpack-python. Use heroku-buildpack-multi to run multiple buildpacks:
$ heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-multi.git
From here you will need to create a .buildpacks file which contains the buildpacks you wish to run when you deploy:
$ cat .buildpacks
https://github.com/djng/heroku-buildpack-webapp-client.git
<YOUR BUILDPACK> [i.e. https://github.com/heroku/heroku-buildpack-ruby.git, https://github.com/heroku/heroku-buildpack-python.git, ...]
Here's an overview of what this buildpack does:
- Almost everything[1] that heroku-buildpack-nodejs does (mainly installs node and npm and runs
npm install). - Installs grunt and compass.
- Installs bower if
client/bower.jsonis available and runsbower install - Runs
grunt build. - Removes everything except the
client/distfolder.
For more technical details, see the heavily-commented compile script.
[1] The following changes are made compared to heroku-buildpack-nodejs:
- Does not automatically creates a Procfile.
- Ignores
NODE_ENVand installdevDependencies. - Installs the 'next' version of npm.
Anvil is a generic build server for Heroku.
gem install anvil-cli
The heroku-anvil CLI plugin is a wrapper for anvil.
heroku plugins:install https://github.com/ddollar/heroku-anvil
The ddollar/test buildpack runs bin/test on your app/buildpack.
heroku build -b ddollar/test # -b can also point to a local directory
For more info on testing, see Best Practices for Testing Buildpacks on the Heroku discussion forum.
If you'd like to contribute, simply fork the repository, commit your changes to the master branch (or branch off of it), and send a pull request.