gulp——myself配置
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat');
var pump = require('pump');
var minifycss = require('gulp-minify-css');
var htmlmin = require('gulp-htmlmin');
gulp.task('compress', function (cb) {
pump([
gulp.src('app/**/*.js'),
uglify(), gulp.dest('build')
],
cb
);
}); gulp.task('default', function () {
gulp
.src('app/**/*.js') // gulp.src从水源地把水取出来,创造第一根管子
//.pipe(concat('all.js'))
.pipe(uglify()) // 新建一个管子,然后把水处理器塞到管子里面
// gulp.dest('build') 其实也是一种水处理器,它的作用是把水引流到某个文件夹下面
.pipe(gulp.dest('dist/js'))
});
/*var htmlmin = require('gulp-htmlmin');
gulp.task('html', function () {
var options = {
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeComments: true,
removeEmptyAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
minifyJS: true, minifyCSS: true
};
gulp.src('app/*.html')
.pipe(htmlmin(options))
//.pipe(rename({suffix: '.min'}))
//.pipe(concat('index.html'))
.pipe(gulp.dest('/dist/html'));
});
*/ gulp.task('htmlmin', function() {
return gulp.src(['app/*/*.html', 'app/*.html'])
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('dist/html'))
//.pipe($.notify({ message: 'htmlmin task done' }));
}); ////压缩css
gulp.task('css', function () {
gulp.src('app/css/*.css') //压缩的文件
//.pipe(rename({suffix: '.min'}))
.pipe(minifycss()) //执行压缩
.pipe(concat('index.css'))
.pipe(gulp.dest('./dist/css')) //输出文件夹
}); gulp.task('watch',function(){
var watcher = gulp.watch('app/*.js',['default']) });
gulp——myself配置的更多相关文章
- 基于流的自动化构建工具------gulp (简单配置)
项目上线也有一阵子,回头过来看了看从最初的项目配置到开发的过程,总有些感慨,疲软期,正好花点时间,看看最初的配置情况 随着前端的发展,前端工程化慢慢成为业内的主流方式,项目开发的各种构建工具,也出现了 ...
- gulp+ThinkPHP配置
gulp+ThinkPHP配置 gulp+ThinkPHP配置 目录结构: html |-src 开发目录 |-Home 静态页面 |-Public 静态资源目录 |-dist 生产目录 |-Home ...
- gulp使用配置
gulpjs是一个前端构建工具,与gruntjs相比,gulpjs无需写一大堆繁杂的配置参数,API也非常简单,学习起来很容易,而且gulpjs使用的是nodejs中stream来读取和操作数据,其速 ...
- 前端构建工具:gulp的配置与使用
安装gulp 因为gulp是基于node的管理工具,所以要先安装nodejs安装nodejsnodejs下载地址:中文站:http://nodejs.cn/ 英文站:https://nodejs.or ...
- 使用gulp自动化配置环境变量
使用gulp拷贝文件,可以完成开发api环境变量的配置,例如公司的线上环境有三个: 1.alpha线上测试环境 2.dev线上测试环境 3.test 本地测试环境 (4.production 正式系统 ...
- gulp实用配置(2)——中小项目
上一篇的gulp配置很简单,主要就是为了demo的查看和调试,这一篇则会相对详细一些,包括压缩合并打时间戳等. 在互联网环境比较好的城市,需要多人协作的,大一点的项目应该都用上了模块化(这里主要指co ...
- gulp+tp5配置
优化了文件过滤,更改文件只会重新生成修改的文件 项目目录构建: 在入口文件public下,创建html目录,作为前台静态资源目录 gulp.js文件 /*! * gulp * $ npm instal ...
- gulp实用配置(1)——demo
在React和Vue推进下,现在很多人都在使用webpack作为自动化构建工具,但其实在很多时候我们并不是一定需要用到它,gulp这样的轻量级构建工具就足够了. 最近一段时间不是太忙,所以就写了三份配 ...
- gulp+webpack配置
转自:https://www.jianshu.com/p/2549c793bb27 gulp gulp是前端开发过程中对代码进行构建的工具,是自动化项目的构建利器:她不仅能对网站资源进行优化,而且在开 ...
- 项目使用gulp的配置编译sass笔记
Node环境 通过 node.js 网站下载了安装包进行安装 node.js, npm也会一起安装 node --version # 查看node.js版本 npm --version #查看npm版 ...
随机推荐
- vim中的高亮全部同样单词的方法
用vim时,想高亮显示一个单词并查找的方发.将光标移动到所找单词. 1: shift + "*" 向下查找并高亮显示 2: shift + "#" 向上查找 ...
- glibc的几个有用的处理二进制位的内置函数(转)
— Built-in Function: int __builtin_ffs (unsigned int x) Returns one plus the index of the least sign ...
- 2、classpath、path、JAVA_HOME的作用
windows xp下配置JDK环境变量: 1.安装JDK,安装过程中可以自定义安装目录等信息,例如我们选择安装目录为D:\java\jdk1.5.0_08: 2.安装完成后,右击“我的电脑”,点击“ ...
- hdu 4031(树状数组+辅助数组)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4031 Attack Time Limit: 5000/3000 MS (Java/Others) ...
- docker login harbor出现的报错Error response from daemon: Get https://172.16.1.99/v1/users/: dial tcp 172.16.1.99:443: getsockopt: connection refused解决方法
出现的问题 [root@master01 ~]# docker login 172.16.1.99 Username: admin Password: Error response from daem ...
- springmvc编码问题
web.xml中加入 <filter> <filter-name>encodingFilter</filter-name> <filter-class> ...
- hduoj----(1033)Edge
Edge Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ( ...
- PHP5.5新特性
详情见:http://www.php.net/manual/zh/migration55.new-features.php 1. 生成器 yield关键字 yield的中文文档在这里:http://p ...
- 开源的数据可视化JavaScript图表库:ECharts
ECharts (Enterprise Charts 商业产品图表库)是基于HTML5 Canvas的一个纯Javascript图表库,提供直观,生动,可交互,可个性化定制的数据可视化图表.创新的拖拽 ...
- 【jQuery】form表单元素序列化为json对象
序列化form表单元素为json对象: <!Doctype html> <html xmlns=http://www.w3.org/1999/xhtml> <head&g ...