Grunt is a build tool much like Ant or Maven, but using the beauty of Javascript.

  1. grunt.file - reading, writing files
  2. Testing Mocha applications with Grunt using Jenkins

My Grunt plugins:

  1. emberjs-handlebars-sanity
  2. grunt-contrib-spritify

Publishing a new Grunt plugin

See Creating Plugins in Grunt. In particular:

  1. Install grunt-init with npm install -g grunt-init
  2. Install the gruntplugin template with git clone git:// ~/.grunt-init/gruntplugin
  3. Run grunt-init gruntplugin in an empty directory. Valid licenses are MIT, GPL-2.0, etc.
  4. Run npm install to prepare the development environment.
  5. Author your plugin.
  6. Run npm adduser to create a new user for publishing plugins - use any username/password/etc you want.
  7. Run npm publish to publish the Grunt plugin to npm!
  8. Use npm search <plugin-name> to check the plugin is now there

Pushing a new version of a Grunt plugin

  1. Update version in package.json
  2. Run npm publish to republish the Grunt plugin to npm
  3. Use npm search <plugin-name> to check the plugin version is updated

There’s no git tagging or anything like that.

Getting working

  1. Install necessary Grunt packages: npm install --save-dev grunt grunt-contrib-coffee grunt-cli
  2. Create a
    module.exports = (grunt) ->
      grunt.registerTask 'default', 'Try Logging', ->
     grunt.log.write('Running the default task')
  3. Run grunt

Concatenating Javascript files together

Use the grunt-neuter task.

        src: 'site/generated/js/generated-coffee.js',
        dest: 'site/generated/js/generated-coffee-compiled.js'

generated-coffee.js can have things like require('path/*').