Grunt is a project that allows you to use JavaScript to configure and run command line tasks. It is installed as an npm module, and very simple to get started with. If you have Node.js and npm installed, simply run:

npm install -g grunt

Some of the common tasks include: JavaScript Lint, QUnit,
minify, JSHint and file concatenation.

Any project that has grunt.js in it’s root (or subdirectories) can use grunt tasks. An example configuration to use grunt lint:

module.exports = function(grunt){
  grunt.initConfig({
    lint: {
      all: ['grunt.js', 'lib/**/*.js''test/**/*.js']
    }
  });
};

Whenever you run grunt lint in this project, the array of files (grunt.js, every JavaScript file in lib/ and every JavaScript file in test/) will be run through JavaScript Lint.

For some extra grunts and giggles, you can checkout grunt’s own gruntfile. They showcase some common uses and are very self explanatory.

As a disclaimer, grunt is currently in beta, and could possibly (will probably) change before 1.0. The good news is the changes will be based on your feedback. Head on over to GitHub to browse the source code and help get this project to it’s final release!


Have comments? Send a tweet to @TheChangelog on Twitter.

Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.