Skip to content

gcko/heroku-buildpack-ruby-nodejs-jekyll

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heroku buildpack: Jekyll with precompilation

This is a Heroku buildpack for Jekyll Apps uses Ruby and Node.js ( with grunt). Check out NPM, GruntJS and SCons.

What does it do?

  • It will detect a ruby application following the default Ruby Buildpack
  • It will detect your app includes Node.js if it has the file package.json in the root. It will use NPM to install your dependencies, and vendors a version of the Node.js runtime into your slug. The node_modules directory will be cached between builds to allow for faster NPM install time.
  • For Jekyll, you no longer need to pre-build the site or commit the _site build directory to your repo. This simplifies the deployment process and keeps the repo clean.

Why do I care?

While Jekyll is cool all by itself, it is even cooler when you can use all the power and benefits of Ruby, Node, and Grunt to your hearts desire. Precompilation for coffeescript? Check. Ability to manage static resources? Checkmate.

Jekyll Auth

Do you need to setup oAuth support, and have a github organization? Cool, check out Jekyll Auth.

Node.js and npm versions

Specify the versions of Node.js and npm your application requires using package.json

{
  "name": "myapp",
  "version": "0.0.1",
  "engines": {
    "node": ">=0.4.7 <0.7.0",
    "npm": ">=1.0.0"
  }
}

To list the available versions of Node.js and npm, see these manifests:

http://heroku-buildpack-nodejs.s3.amazonaws.com/manifest.nodejs

http://heroku-buildpack-nodejs.s3.amazonaws.com/manifest.npm

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. 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 https://github.com/mbuchetics/heroku-buildpack-nodejs-grunt.git

Or add this buildpack to your current app:

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

Add the sneaky option to enable config vars during compile:

heroku labs:enable user-env-compile -a myapp

Set the NODE_ENV environment variable (e.g. development or production):

heroku config:set NODE_ENV=production

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:development', 'clean less mincss');

or

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

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": "*"
}

NPM Debugging

npm can be run with a verbose flag to help debugging if something fails when installing the dependencies.

  • if the VERBOSE environment variable is set, npm is always run with verbose logging.
  • if BUILDPACK_RETRY_VERBOSE is set, npm is relaunched in verbose mode if npm failed.

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 64.6%
  • Shell 29.7%
  • Perl 5.7%