Creating the build
Let's look at the various steps involved in using Grunt to create the build for a single-page application.
Step 1 – initial directory setup
We begin our project by creating a root directory, project
. Within this directory, we create an src
directory to house our source files. Then, we initialize the project's package.json
file, install the local grunt
module, and finally, create an empty Gruntfile.js
file. We can do this on the command line with:
$ mkdir project $ cd project/ $ mkdir src $ npm init $ npm install --save-dev grunt $ echo "module.exports = function(grunt) {};" > Gruntfile.js
As we might expect, the echo
command echoes the provided string back to the command line (which is known as standard out or "stdout"). The arrow (>
), however, redirects standard out to a file. So, this last line is just a short way of creating and initializing a file. It is not necessary to create these files and directories on the command line, as long as we end up with the following...