gulp操作基本功能.md
gulp操作基本功能.示例代码:
var gulp = require("gulp");//创建 gulp模块
var adel = require("del");//创建 gulp模块
var jsCompass = require("gulp-uglify");//创建js混淆压缩 模块
var minify_css =require("gulp-minify-css");//创建 css混淆压缩模块
var gulp_concat = require('gulp-concat');//创建 文件合并模块
var gulp =require("gulp");//创建 gulp模块
gulp.task('min-js',function(){ //1
gulp.src('./js/*.js') //2
.pipe(jsCompass())//4.混淆即压缩
.pipe(gulp.dest('./dist/js'));//5.输出路径
});
gulp.task('min-css',function(){ //1
gulp.src('./css/*.css') //2
.pipe(minify_css())//4.混淆即压缩
.pipe(gulp.dest('./dist/css'));//5.输出路径
});
gulp.task('clean',function(cb){ //1
adel([
'basic.css',
'dist/**/*'
], cb);
});
gulp.task('build',['min-js','min-css'],function(){ //1
console.log("build finished!");
});
备注:./表示在当前目录下