If I execute this code it will throw an error saying it only accepts a function instead of the three tasks
gulp.task('build', ['clean'], ['styles', 'scripts', 'images']);
I want to execute the clean task before the other three, I don't want to wire the clean task to each single task when I define them as clean will delete my whole build folder.
How do I do it?
This is the API reference https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulptaskname-deps-fn
答案 0 :(得分:0)
使用
gulp.task('build',['clean','styles','scripts','images']);
清理任务将是构建依赖于启动的第一个任务,但它们将全部并行启动。首先启动清洁是由于实施,可能会更改,恕不另行通知。
这应该有效:
gulp.task('build', ['clean'], function(cb)
{
var runSequence = require('run-sequence');
runSequence( ['styles', 'scripts', 'images']);
} );