HTML and CSS Reference
In-Depth Information
This will install the TypeScript compiler into your project directory, as illustrated in Figure
19-2
.
Figure 19-2.
Here, you can see that npm was used to install the Typescript compiler, and it has been downloaded
and installed correctly
Next, you will want to run through the following commands, one at a time, and let each of them install before
moving on to the next plug-in:
npm install grunt-typescript --save-dev
npm install grunt-contrib-watch --save-dev
npm install grunt-contrib-connect --save-dev
npm install grunt-open --save-dev
Now, if you take a look at the
package.json
file in your project, you should see all your modules installed under
the
developerDependencies
JavaScript Object Notation (JSON) object, as follows:
"devDependencies": {
"typescript": "~0.9.1-1",
"grunt": "~0.4.1",
"grunt-typescript": "~0.2.4",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-connect": "~0.5.0",
"grunt-open": "~0.2.2"
}
Note that you may have different version numbers, as npm installs the latest one.
Next, you need to create a
GruntFile.js
in your project. Open it, and let's import your modules:
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-typescript');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-open');
}