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
Laravel 5.3 中文文档Laravel Elixir 6.0 和 Laravel 5.3 一起发布,新版本将捆绑支持 Webpack 和 Rollup JavaScript 模块。 默认情况下,Laravel 5.3 的 gulpfile.js 文件现在已经使用 Webpack 来编译 JavaScript: elixir(mix => { mix.sass('app.scss') .webpack('app install 安装好前端依赖之后,可以使用 Gulp 编译 SASS 文件为原生的 CSS,gulp 命令 会处理 gulpfile.js 文件中的声明。通常,编译好的 CSS 文件会被放置到 public/css 目录下: gulp Laravel 自带的默认 gulpfile.js 文件会编译 SASS 文件 resources/assets/sass/app.scss,这个 app.scss gulp 命令来编译前端资源,Gulp 是一个 JavaScript 命令行构建工 具,当你执行 gulp 命令的时候,Gulp 将会执行 gulpfile.js 中的声明: gulp 默认情况下,Laravel 自带的 gulpfile.js 将会编译 SASS 和 resources/assets/js/app.js 文件, 在 app.js 文件中你可以注册 Vue 组件,或者你倾向于其它0 码力 | 691 页 | 9.37 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
Egg & Node.js 从⼩⼯坊⾛向企业级开发升职加薪后的故事 如果底层或骨架更新了, 那 20 个旧项目如何更新呢? 升职加薪后的故事 ▸ 你的团队是否遇到过: ▸ 维护很多个项⽬目,每个项⽬目都需要复制拷⻉贝诸如 gulpfile.js / webpack.config.js 之类的⽂文件。 ▸ 每个项⽬目都需要使⽤用⼀一些相同的类库,相同的配置。 ▸ 在新项⽬目中对做了了⼀一个优化后,如何同步到其他项⽬目? ▸0 码力 | 70 页 | 7.57 MB | 1 年前3
Laravel 5.1 中文文档很不方便,可以使用 gulp watch 命令。该命令将会 一直在终端运行并监控前端文件的改动。当改变发生时,新文件将会自动被编译: gulp watch 4、处理 CSS 项目根目录下的 gulpfile.js 文件包含了所有的 Elixir 任务。Elixir 任务可以使用方法链的方 式链接起来用于定义前端资源如何被编译。 4.1 Less 要将 Less 编译成 CSS,可以使用 less Gulpfile 顶端,或者将其解析到自定义的任务文件。例如,如果 你将扩展放在 elixir-extensions.js,可以在主 Gulpfile 中像这样引入该文件: // File: Gulpfile.js var elixir = require('laravel-elixir'); require('./elixir-extensions') elixir(function(mix)0 码力 | 307 页 | 3.46 MB | 1 年前3
Laravel 5.2 中文文档很不方便,可以使用 gulp watch 命令。该命令将 会一直在终端运行并监控前端文件的改动。当改变发生时,新文件将会自动被编译: gulp watch 4、处理 CSS 项目根目录下的 gulpfile.js 文件包含了所有的 Elixir 任务。Elixir 任务可以使用方法链 的方式链接起来用于定义前端资源如何被编译。 4.1 Less 要将 Less 编译成 CSS,可以使用 less Gulpfile 顶端,或者将其解析到自定义的任务文件。例 如,如果你将扩展放在 elixir-extensions.js,可以在主 Gulpfile 中像这样引入该文 件: // File: Gulpfile.js var elixir = require('laravel-elixir'); require('./elixir-extensions') elixir(function(mix)0 码力 | 377 页 | 4.56 MB | 1 年前3
共 9 条
- 1













