前端文档

gulpjs介绍和安装

日期:2016-10-09 阅读:840

http://www.gulpjs.com.cn/docs/getting-started/

https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md

1. Install gulp globally:

If you have previously installed a version of gulp globally, please run npm rm --global gulp to make sure your old version doesn't collide with gulp-cli.

$ npm install --global gulp-cli

如果先安装了gulp的话,先卸载。


2. Initialize your project directory:

$ npm init   这是为了建一个package.json文件


3. Install gulp in your project devDependencies:

$ npm install --save-dev gulp  本地安装gulp,这样gulp会在当前目录的node-modules里。


4. Create a gulpfile.js at the root of your project:

var gulp = require('gulp');

gulp.task('default', function() {
  // place code for your default task here
});


5. Run gulp:

$ gulp
The default task will run and do nothing.

To run individual tasks, use gulp <task> <othertask>.

<<点击返回