小编典典

如何依次依次运行Gulp任务

node.js

在以下代码段中:

gulp.task "coffee", ->
    gulp.src("src/server/**/*.coffee")
        .pipe(coffee {bare: true}).on("error",gutil.log)
        .pipe(gulp.dest "bin")

gulp.task "clean",->
    gulp.src("bin", {read:false})
        .pipe clean
            force:true

gulp.task 'develop',['clean','coffee'], ->
    console.log "run something else"

develop我要运行clean的任务中,完成后再运行,然后在完成后再coffee运行其他东西。但是我无法弄清楚。这件作品不起作用。请指教。


阅读 177

收藏
2020-07-07

共1个答案

小编典典

它不是正式版本,但是即将推出的Gulp 4.0使您可以轻松地使用gulp.series进行同步任务。您可以像这样简单地做到这一点:

gulp.task('develop', gulp.series('clean', 'coffee'))

我找到了一篇不错的博客文章,介绍了如何升级和利用这些简洁功能: 通过示例迁移到gulp
4

2020-07-07