Java Reference
In-Depth Information
$ npm init
You will be prompted for parameters such as the project name, version, author, and so on.
Hit return to accept the defaults. Your folder will now contain a package.json file that
defines which dependencies you require. First, you must install a local version of Gulp as
a development dependency:
$ npm install --save-dev gulp
Next, you'll to install the necessary Gulp plugins. These are the gulp-strip-debug
plugin to remove any console.log() statements and the gulp-uglify plugin to
minify the code. To install these, enter the following commands in a terminal prompt:
$ npm install --save-dev gulp-strip-debug gulp-uglify
Gulp and the plugins will now be shown in the devDependencies section of your pack-
age.json file:
{
"name": "Quiz Ninja",
"version": "1.0.0",
"description": "My first JavaScript project",
"main": "index.html",
"devDependencies": {
"gulp": "^3.8.10",
"gulp-strip-debug": "^1.0.1",
"gulp-uglify": "^1.0.1"
}
}
You'll also have a node_modules folder where Gulp and the plugins have been installed.
Note: Sharing Your Project
Our node_modules folder only contains development dependencies, so it
need not be distributed with the code. If you're using Git, you could add
node_modules/ to the .gitignore file.
Search WWH ::




Custom Search