This is a Heroku buildpack for Bower & Grunt.
This buildpack was started as a fork from the official Heroku buildpack for Node.js apps, and as such, has many of the same features.
This buildpack can be used alone or as part of a chain of multiple buildpacks, whether Node or something else. It does not require the Node buildpack, and will work as long as you've got a package.json file, and one of bower.json, Gruntfile.js, or Gruntfile.coffee.
This buildpack installs npm packages from your devDependencies, then cleans them up after it's done so that your slug stays small.
This buildpack will install bower and grunt-cli for you, since you should've installed them globally, and not added them to your devDependencies.
It will call bower and then grunt in that order, if necessary.
If you've got a bower.json file, then the buildpack will run bower install
.
If $NPM_CONFIG_PRODUCTION
is true (default), then we will use the --production
flag.
If you've got a Gruntfile.js or Gruntfile.coffee file, then the buildpack will run grunt heroku
.
You must have a task registered like so in your Gruntfile: grunt.registerTask('heroku', ['some', 'thing']);
.
You also should have grunt, and the various grunt npm libraries you use defined in devDependencies of your package.json.
You'll first want you to set your buildpack to the multi buildpack:
$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-multi.git
From here you will need to create a .buildpacks
file which contains (in order) the buildpacks you wish to run when you deploy:
$ cat .buildpacks
https://github.com/heroku/heroku-buildpack-nodejs.git
https://github.com/gfguthrie/heroku-buildpack-bower-grunt.git
Thanks to Matthias Buchetics for ideas taken from his Node.js Grunt buildpack.
These options are the holdovers left from this project being a fork of the Node.js buildpack.
Set engines.node in package.json to the semver range (or specific version) of node you'd like to use. (It's a good idea to make this the same version you use during development)
"engines": {
"node": "0.11.x"
}
"engines": {
"node": "0.10.33"
}
Default: the latest stable version.
Set engines.npm in package.json to the semver range (or specific version) of npm you'd like to use. (It's a good idea to make this the same version you use during development)
Since 'npm 2' shipped several major bugfixes, you might try:
"engines": {
"npm": "2.x"
}
"engines": {
"npm": "^2.1.0"
}
Default: the version of npm bundled with your node install (varies).
Sometimes, a project needs custom npm behavior to set up proxies,
use a different registry, etc. For such behavior,
just include an .npmrc
file in the root of your project:
# .npmrc
registry = 'https://custom-registry.com/'
Having trouble? Dig it? Feature request?
To make changes to this buildpack, fork it on Github. Push up changes to your fork, then create a new Heroku app to test it, or configure an existing app to use your buildpack:
# Create a new Heroku app that uses your buildpack
heroku create --buildpack <your-github-url>
# Configure an existing Heroku app to use your buildpack
heroku config:set BUILDPACK_URL=<your-github-url>
# You can also use a git branch!
heroku config:set BUILDPACK_URL=<your-github-url>#your-branch
The buildpack tests use Docker to simulate Heroku's Cedar and Cedar-14 containers.
To run the test suite:
test/docker
Or to just test in cedar or cedar-14:
test/docker cedar
test/docker cedar-14
The tests are run via the vendored shunit2 test framework.