Node JS is a new generation of server side software. This tutorial focuses on installing the platform, and provides resources for using Grunt.

Step 1: Download the latest stable binary from nodejs.org. At the time of writing its 0.10.5. For this tutorial, I just used the default settings.

Image of Node Settings

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

Iage showing the path

Note: I found this post useful: architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/. 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:

sudo 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.

Additional sources used

For more grunt resources, check out the below.

Google Chrome Grunt dev tools.

A tutorial for getting started with Grunt for plugin section.

"Developing with Grunt" by Dan Heberden (from jqueryTO conference): Audio | Slides.

Meet Grunt: The Build Tool for JavaScript

DailyJS: Backbone.js Tutorial: Build Environment