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
BabelJS TutorialBabelJS 66 package.json after installation Let us now create the gulpfile.js, which will help run the task to bundle the modules together. We will use the same files used "font-size:30px;color:green;"); The gulpfile.js is created here. A user will browserfiy and use tranform to babelify. babel- preset-env is used to transpile the code to es5. Gulpfile.js const gulp = require('gulp'); We will add the Preset environment details to .babelrc file as follows: gulpfile.js var gulp =require('gulp'); var babel =require('gulp-babel'); var connect = require("gulp-connect");0 码力 | 173 页 | 2.70 MB | 1 年前3
TypeScript Handbook(中文版)
Studio将开始安装gulp和del。 若没有自动开始,请右击 package.json文件选择Restore Packages。 设置 gulp 最后,添加一个新JavaScript文件 gulpfile.js 。 键入以下内容: TypeScript Handbook(中文版) 21 ASP.NET Core ///gulpfile.js 并选择Task Runner Explorer。 若'default'和'clean'任 务没有显示输出内容的话,请刷新explorer: 编写HTML页 TypeScript Handbook(中文版) 我们需要添加: 1. 库文件目录。 2. 添加一个 lib 任务来输送文件到 wwwroot 。 3. 在 default 任务上添加 lib 任务依赖。 更新后的 gulpfile.js 像如下所示: TypeScript Handbook(中文版) 26 ASP.NET Core /// 0 码力 | 557 页 | 7.48 MB | 1 年前3
TypeScript 4.0 使用手册
保存这个文件后,Visual Studio将开始安装gulp和del。 若没有自动开始,请右击 package.json文件选择Restore Packages。 最后,添加一个新JavaScript文件 gulpfile.js 。 键入以下内容: 1. ///2. /* 3. This file is the 第一行是告诉Visual Studio构建完成后,立即运行’default’任务。 当你应答 Visual Studio 清除构建内容后,它也将运行’clean’任务。 现在,右击 gulpfile.js 并选择Task Runner Explorer。 若’default’和’clean’任务没有 显示输出内容的话,请刷新explorer: 在 wwwroot 中添加一个新建项 index 我们需要添加: 1. 库文件目录。 2. 添加一个 lib 任务来输送文件到 wwwroot 。 3. 在 default 任务上添加 lib 任务依赖。 更新后的 gulpfile.js 像如下所示: 1. /// 2. /* 将 Angular 添加到 gulp 构建中 0 码力 | 683 页 | 6.27 MB | 1 年前3
共 5 条
- 1













