本文介绍了如何一个接一个地顺序运行Gulp任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如下所示:
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"
在 / code>任务我想运行
clean
,完成后,运行 coffee
运行别的东西。但我不能想出来。这件不工作。请指教。
In develop
task I want to run clean
and after it's done, run coffee
and when that's done, run something else. But I can't figure that out. This piece doesn't work. Please advise.
推荐答案
这个问题的唯一好的解决方案可以在gulp文档找到
The only good solution to this problem can be found in the gulp documentation which can be found here
var gulp = require('gulp');
// takes in a callback so the engine knows when it'll be done
gulp.task('one', function(cb) {
// do stuff -- async or otherwise
cb(err); // if err is not null and not undefined, the orchestration will stop, and 'two' will not run
});
// identifies a dependent task must be complete before this one begins
gulp.task('two', ['one'], function() {
// task 'one' is done now
});
gulp.task('default', ['one', 'two']);
// alternatively: gulp.task('default', ['two']);
这篇关于如何一个接一个地顺序运行Gulp任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!