This tutorial focuses on installing the platform, and provides resources for using Grunt.

This was originally from May 8, 2013 and has been re-written for the latest version of Node and Grunt.

Step 1: Download the latest stable binary from nodejs.org. On production serers is recommended to use the latest STABLE version. The default settings will be fine.

NodeJS.com homepage

Step 2: Verify your path as per installer message: Make sure that /usr/local/bin is in your $PATH.

Installer screenshot after intsall is successful

Note: I found this Stackoverflow post useful: https://stackoverflow.com. Please note to check that the path in the installer is shown in case it differs between versions. For my install, the path was correctly set.

GRUNT SET-UP

Step 1: Installing Grunt on your machine globally.

This section uses grunt 0.4.x

This guide was made from referring to the official getting started documentation: http://gruntjs.com/getting-started. The sections referred to in this blog are: "Installing the CLI" and "Preparing a new grunt project". Grunt JS is installed by what node js refers to as NPM, or Node Package Manager. To install Grunt from NPM, you will need to use the command line.

Type following command into the terminal:

npm install -g grunt-cli

Step 2: Create a package.json file

go into your project directory, and run the below command. You can use the default settings, as the text file will be edited. My output is below.

npm init

run npm init

Open your favourite text editor, and edit the file "package.json" replace the text so it reads similar to the below:

{
"name": "demo-project",
"version": "0.0.1",
"author": "Jennifer Tesolin"
}

Now, using the terminal, run the below command in your project directory:

npm install grunt --save-dev
npm install

This will install grunt into your locally in your package folder. If you open your package.json, you will find a new section added:

,
"devDependencies": {
"grunt": "~0.4.1"
}

Associating plugins with Grunt/package.json

Run the below command to use the plugin npm.

npm install grunt-contrib --save-dev

Create your grunt file

In your text editor, create a file called "Gruntfile.js" and save this into your project directory. A sample copy is below:

module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({

});

// Load call for plugins

// Default task(s).

};

Check out the plugin's you can configure here: http://gruntjs.com/sample-gruntfile.

My current grunt file:
https://gist.github.com/jennifert/9037731119d3b7200bb17229822c4fb8

Additional sources used

For more grunt resources, check out the below.

Tutsplus.com's How-to tutorials

Sitepoint.com's How-to tutorials

A Simple Guide to Getting Started With Grunt ― Scotch

Google Chrome Grunt dev tools.

A tutorial for getting started with Grunt for plugin section.

Meet Grunt: The Build Tool for JavaScript

DailyJS: Backbone.js Tutorial: Build Environment