heroku-buildpack-nodejs-grunt-compass

by pydawg

GitHub Readme.md

Heroku buildpack: Node.js with grunt support

Supported Grunt versions: 0.3 and 0.4. See the Grunt migration guide if you are upgrading from 0.3.

This is a fork of Heroku's official Node.js buildpack with added Grunt support. This buildpack will be modified as needed to meet our specific requirements, please fork if you want a reliable instance of your own. Using this buildpack you do not need to commit the results of your Grunt tasks (e.g. minification and concatination of files), keeping your repository clean.

After all the default Node.js and NPM build tasks have finished, the buildpack checks if a Gruntfile (Gruntfile.js, Gruntfile.coffeeor grunt.js) exists and executes the heroku task by running grunt heroku. For details about grunt and how to define tasks, check out the offical documentation. You must add grunt to the NPM dependencies in your package.json file. If no Gruntfile exists, the buildpacks simply skips the grunt step and executes like the standard Node.js buildpack.

Usage

Create a new app with this buildpack:

heroku create myapp --buildpack heroku config:add BUILDPACK_URL=https://github.com/nbcnews/heroku-buildpack-nodejs-grunt-compass.git

Or add this buildpack to your current app:

heroku config:add BUILDPACK_URL=https://github.com/nbcnews/heroku-buildpack-nodejs-grunt-compass.git

Or change the buildpack for a specific app:

heroku config:add BUILDPACK_URL=https://github.com/nbcnews/heroku-buildpack-nodejs-grunt-compass.git --app APP_NAME

Create your Node.js app and add a Gruntfile named Gruntfile.js (or Gruntfile.coffee if you want to use CoffeeScript, or grunt.js if you are using Grunt 0.3) with a heroku task:

grunt.registerTask('heroku', 'clean less mincss');

Don't forget to add grunt to your dependencies in package.json. If your grunt tasks depend on other pre-defined tasks make sure to add these dependencies as well:

"dependencies": {
    ...
    "grunt": "*",
    "grunt-contrib": "*",
    "less": "*"
}

Push to heroku

git push heroku master
...
-----> Heroku receiving push
-----> Fetching custom buildpack... done
-----> Node.js app detected
-----> Resolving engine versions
       Using Node.js version: 0.8.2
       Using npm version: 1.1.41
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
       ...
       Dependencies installed
-----> Building runtime environment
-----> Found gruntfile, running grunt heroku task
Running "heroku" task
...
-----> Discovering process types

Further Information

Heroku: Buildpacks

Heroku: Getting Started with Node.js

Buildpacks: Heroku for Everything

Grunt: a task-based command line build tool for JavaScript projects