問題描述
在這樣的片段中:
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
任務(wù)中,我想運(yùn)行 clean
并在完成后運(yùn)行 coffee
,完成后運(yùn)行其他內(nèi)容.但我無法弄清楚.這塊不行.請(qǐng)指教.
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.
推薦答案
它還沒有正式發(fā)布,但是即將推出的 Gulp 4.0 讓您可以輕松地使用 gulp.series 執(zhí)行同步任務(wù).你可以這樣做:
It's not an official release yet, but the coming up Gulp 4.0 lets you easily do synchronous tasks with gulp.series. You can simply do it like this:
gulp.task('develop', gulp.series('clean', 'coffee'))
我找到了一篇很好的博客文章,介紹了如何升級(jí)和使用這些簡(jiǎn)潔的功能:通過示例遷移到 gulp 4
I found a good blog post introducing how to upgrade and make a use of those neat features: migrating to gulp 4 by example
這篇關(guān)于如何一個(gè)接一個(gè)地依次運(yùn)行 Gulp 任務(wù)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!