wscats / glup Goto Github PK
View Code? Open in Web Editor NEWSome of the gulp tutorial -《gulp笔记》
Some of the gulp tutorial -《gulp笔记》
var gulp = require('gulp'),
minifycss = require('gulp-minify-css'),
//minifyhtml = require('gulp-minify-html'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
//imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
del = require('del'),
less = require('gulp-less');
gulp.task('less', function () {
return gulp.src('less/bootstrap.less')
.pipe(less())
.pipe(gulp.dest('dist/style'));
});
gulp.task('minify', function() {
return gulp.src(['js/*.js'])
.pipe(concat('main.js')) //合并所有js到main.js
.pipe(rename({
suffix: '.min'
})) //rename压缩后的文件名 让main.js变成main.min.js
.pipe(uglify()) //执行压缩
.pipe(gulp.dest('./dist/js'))
});
gulp.task('minifycss', function() {
return gulp.src('./style/*.css') //压缩的文件
.pipe(concat('main.css')) //合并所有js到main.js
.pipe(rename({
suffix: '.min'
}))
.pipe(minifycss())
.pipe(gulp.dest('./dist/style')); //输出文件夹
});
gulp.task('imagemin', function() {
return gulp.src('./images/*.+(jpeg|jpg|png)')
.pipe(imagemin({
optimizationLevel: 7, //类型:Number 默认:3 取值范围:0-7(优化等级)
progressive: true, //类型:Boolean 默认:false 无损压缩jpg图片
interlaced: true, //类型:Boolean 默认:false 隔行扫描gif进行渲染
multipass: true //类型:Boolean 默认:false 多次优化svg直到完全优化
}))
.pipe(gulp.dest('./dist/images'));
});
gulp.task('default', ['minify', 'minifycss', 'less', 'imagemin']);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.