Gulp 入门指南建议:你可以只阅读下面的代码与注释或同时阅读代码解释 gulp 的所有配置代码都写在 gulpfile.js 文件。 一、新建一个 一、新建一个 gulpfile.js gulpfile.js 文件 文件 chapter2 └── gulpfile.js 二、在 二、在 gulpfile.js gulpfile.js 中编写代码 中编写代码 // 获取 gulp var gulp = require('gulp') 理解为将操作加入执行队列 参考:gulp API文档 五、跳转至 五、跳转至 gulpfile.js gulpfile.js 所在目录 所在目录 打开命令行使用 cd 命令跳转至 gulpfile.js 文件所在目录。 例如我的 gulpfile.js 文件保存在 C:\gulp-book\demo\chapter2\gulpfile.js 。 那么就需要在命令行输入 cd C:\gulp-book\demo\chapter2 安装的模块。 目录结构: ├── gulpfile.js └── node_modules └── gulp-uglify 接着输入 gulp script 执行任务 gulp script [13:34:57] Using gulpfile ~/Documents/code/gulp-book/demo/chapter2/gulpfile.js [13:34:57] Starting0 码力 | 36 页 | 275.87 KB | 1 年前3
Learning GulpInitialize your project directory: 3 4. Install gulp in your project devDependencies: 3 5. Create a gulpfile.js at the root of your project: 3 6. Run gulp: 3 Task dependency 3 Concat js file in sub folder 4. Install gulp in your project devDependencies: $ npm install --save-dev gulp 5. Create a gulpfile.js at the root of your project: var gulp = require('gulp'); gulp.task('default', function() { Browser Sync. bash $ npm install browser-sync --save-dev With that premise, let us open our gulpfile.js and add the watch functionality. Let us require browser sync and define some variables to use0 码力 | 45 页 | 977.19 KB | 1 年前3
共 2 条
- 1













