gulp 的原生方法
发布日期:2021-05-08 13:33:01 浏览次数:18 分类:精选文章

本文共 589 字,大约阅读时间需要 1 分钟。

gulp的 同步异步的批量执行

const {src, dest,watch,series,parallel} = require("gulp")function fn1(done){    console.log("A")    done()}function fn2(done){    console.log("B");    done()}function fn3(done){    console.log("C")    done()}exports.syncAll = series(fn1,fn2,fn3)  		/*同步*/exports.asyncAll = parallel(fn1,fn2,fn3)    /*异步*/

文件的转存

**src()根据指定路径读取文件,得到指定文件的流对象

dest() 将拿到的流对象,转存到指定路径,生成文件
watch() 自动转存 **

function copFn(done){    src(["development/index.html"]).pipe(dest("dist"))    done()}function watchFn(done){    watch(["development/index.html"],copFn);    done()}exports.watch = watchFn;
上一篇:JS中合并对象 Object.assign方法
下一篇:用jquery实现简单的某度搜索框效果

发表评论

最新留言

表示我来过!
[***.240.166.169]2025年04月01日 18时00分25秒