gulp的压缩

https://www.cnblogs.com/enginex/p/7147728.html

var gulp = require('gulp');
//var sass = require('gulp-sass');

gulp.task("copy-html",function(){
    gulp.src("*.html")
    .pipe(gulp.dest("D:/phpStudy/WWW/item"))
})
gulp.task("copy-css",function(){
    gulp.src("css/*.css")
    .pipe(gulp.dest("D:/phpStudy/WWW/item/css/"))
})
gulp.task("images",function(){
    gulp.src("img/*.{jpg,png,gif,bmp}")
    .pipe(gulp.dest("D:/phpStudy/WWW/item/img/"))
})
gulp.task("html",function(){
    gulp.src("html/*.html")
    .pipe(gulp.dest("D:/phpStudy/WWW/item/html/"))
})
gulp.task("js",function(){
    gulp.src("js/*.js")
    .pipe(gulp.dest("D:/phpStudy/WWW/item/js/"))
})
gulp.task("font",function(){
    gulp.src("font/**")
    .pipe(gulp.dest("D:/phpStudy/WWW/item/font/"))
})
gulp.task("php",function(){
    gulp.src("php/*.php")
    .pipe(gulp.dest("D:/phpStudy/WWW/item/php"))
})

gulp.task("sass",function(){
    gulp.src("scss/*.scss")
    .pipe(sass())
    .pipe(gulp.dest("D:/phpStudy/WWW/item/css/"))
})
gulp.task('all',function(){//copy这些项目收文件到服务器下
    gulp.src(['*/**/*','index.html','!node_modules/**/*','!*.json','!*.project']).pipe(gulp.dest('D:/phpStudy/WWW/item'));
});
gulp.task("watchAll",function(){
    gulp.watch("*.html",["copy-html"]);
    gulp.watch("css/*.css",["copy-css"]);
    gulp.watch("img/*.{jpg,png,gif,bmp}",["images"]);
    gulp.watch("html/*.html",["html"]);
    gulp.watch("js/*.js",["js"]);
    gulp.watch("font/**",["font"]);
    gulp.watch("php/*.php",["php"]);
    gulp.watch("scss/*.scss",["sass"]);
})

 

posted @ 2018-03-15 14:59  韩麗璃  阅读(104)  评论(0编辑  收藏  举报
返回顶部
打赏