First, the preparatory work
1. What is NPM?
NPM is Nodejs's package management tool that manages, updates, searches, and publishes node's packages. The GULP is installed through NPM. About NPM Chinese introduction, here is a very good article: http://www.cnblogs.com/chyingp/p/npm.html
For a complete NPM document, see here: https://docs.npmjs.com
2. Install node. js and upgrade NPM to the latest version
Nodejs Install: Open nodejs.org Download Nodejs installation package, and follow the prompts to install, here do not repeat.
NPM Upgrade: When the Nodejs is installed, NPM is available, open the command line execution npm-v If the version number is displayed correctly, the installation is not a problem. Since NPM updates faster than Nodejs, enter npm install npm-g to upgrade NPM.
3, Gitbash
Command-line tool CMD under Windows is really hard to use, here is an alternative, and it is recommended to install Gitbash. You can use git anyway, just choose the Gitbash component when you install Git. GIT installation here does not do too much explanation, in doubt can ask in reply.
4. What is Gulp
Gulp's official introduction is to enhance your workflow with automated build tools! --automate and enhance your workflow! It has many advantages, such as easy-to-use, fast-build, high-quality plug-ins, easy to learn. The next section will be carefully discussed and appreciate the style of gulp!
Second, Installation Gulp
Awaited began to come out, finally to gulp debut time. If you're already tired of the previous three steps, installing Gulp is a great time to take a break. Gulp's development team made the installation process perfect, without the need for complex configurations, and without lengthy waits. Nonsense don't say, get to the point:
First, open the Gitbash tool, find a location, create and enter a project folder, and enter the following command to complete the Gulp installation.
Global installation Please execute the NPM install--global Gulp in the project directory installation Please enter NPM install--save-dev Gulp
Then, create a configuration file named Gulpfile.js in the current directory and enter the following code, where an empty task is created (only as a Test gulp is working correctly)
var gulp = require (' gulp '); Gulp.task (' Default ', function () { //place code for your default task here});
Finally, execute the $ Gulp Run Gulp, and if the correct output resembles the following information, the Gulp is properly installed and running.
$ gulp[11:13:17] Using gulpfile xxx\gulpfile.js[11:13:17] starting ' default ' ... [11:13:17] finished ' default ' after 44μs$_
At this point, Gulp has been installed, the following to do is familiar with how to use gulp, and its surrounding ecology.
Citation: Kelsen
Install gulp[on Windows)