使用gulp 怎样配置文件

引入模块 gulp
var gulp = require(‘gulp’);

创建执行目录

需要进行监听的文件 以及目录
//gulp.task(“html”,async()=>{
// gulp.src(“html/**/*”)//文件目录
// .pipe(gulp.dest(“D:\phpStudy\PHPTutorial\WWW\floweritem\html”));。//要将文件存放的目录
//});

//gulp.task(“php”,async()=>{
// gulp.src(“php//*")
// .pipe(gulp.dest(“D:\phpStudy\PHPTutorial\WWW\floweritem\php”));
//});
//
//gulp.task(“css”,async()=>{
// gulp.src("css/
/")
// .pipe(gulp.dest(“D:\phpStudy\PHPTutorial\WWW\floweritem\css”));
//});
//gulp.task(“js”,async()=>{
// gulp.src("js/**/
”)
// .pipe(gulp.dest(“D:\phpStudy\PHPTutorial\WWW\floweritem\js”));
//});
//gulp.task(“font”,async()=>{
// gulp.src(“font//*")
// .pipe(gulp.dest(“D:\phpStudy\PHPTutorial\WWW\floweritem\font”));
//});
//
//gulp.task(“images”,async()=>{
// gulp.src("images/
/*”)
// .pipe(gulp.dest(“D:\phpStudy\PHPTutorial\WWW\floweritem\images”));
//});

4.0的写法
gulp.task(“watch-all”,async ()=>{

gulp.watch("html",async()=>{
    gulp.src("html/**/*")
        .pipe(gulp.dest("C:\\myphp_www\\PHPTutorial\\WWW\\baidunuomi"));
});

gulp.watch("php",async()=>{
    gulp.src("php/**/*")
        .pipe(gulp.dest("D:\\phpStudy\\PHPTutorial\\WWW\\floweritem\\php"));
});

gulp.watch("css",async()=>{
    gulp.src("css/**/*")
        .pipe(gulp.dest("D:\\phpStudy\\PHPTutorial\\WWW\\floweritem\\css"));
});

gulp.watch("js",async()=>{
    gulp.src("js/**/*")
        .pipe(gulp.dest("D:\\phpStudy\\PHPTutorial\\WWW\\floweritem\\js"));
});

gulp.watch("font",async()=>{
    gulp.src("font/**/*")
        .pipe(gulp.dest("D:\\phpStudy\\PHPTutorial\\WWW\\floweritem\\font"));
});

gulp.watch("images",async()=>{
    gulp.src("images/**/*")
        .pipe(gulp.dest("D:\\phpStudy\\PHPTutorial\\WWW\\floweritem\\images"));
});

});

猜你喜欢

转载自blog.csdn.net/mlonly/article/details/86538216