HTML and CSS Reference
In-Depth Information
Now, if you look in your directory, you will see a package.json file. Open it with your text/code editor of choice,
and it should have the following structure:
{
"name": "NodeSampleProject",
"version": "1.0.0",
"description": "A sample nodejs project",
"main": "index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Jesse Freeman",
"license": "BSD-2-Clause"
}
Over time, as you add new packages to your project and continue to flesh out your build script, this file will
automatically populate with anything you install via npm. You will come back to this file later on, when you start
adding more Node modules to your project. For now, let's focus on installing the first package, which is Grunt.
Installing Grunt
Grunt is a JavaScript task runner. This means that you can define a set of tasks, similar to macros in other programs,
that can run in order and be strung together to build more complex operations, which will become your final build
script. To get started, you will need to install Grunt's command-line tools globally on your computer, which will allow
Grunt to work in any project you create moving forward. To do this, enter the following command at the prompt:
> npm install -g grunt-cli
As the tools install, you should see the downloaded output, as shown in Figure 23-9 .
Figure 23-9. As each part of the package is downloaded, it will be displayed at the command prompt
Basically, npm is downloading and installing everything required to run Grunt on the command line.
 
Search WWH ::




Custom Search