Reputation: 24602
I'm trying to understand more about running gulp4 tasks in a serial manner. One answer that was given to me was this:
gulp.task('make-prod-ex1', gulp.series(
function(done) {
makeAppHtml('app/**/*ex1', done);
},
'makeTemplate',
'clean-css',
'make-css-files',
'make-css-bundle',
'rename-css-bundle',
'clean-js',
'make-js-bundle',
'rename-js-bundle',
'rename-index',
function (done) {
console.log("Completed");
done();
}));
Something I don't understand is what is the significance of the word done
here.
Why is there a done
in the first function call, why is it an argument of makeAppHtml and why is it used again in the last function call but this time with a () after it?
Note that I did check the gulp docs and again I see so many uses of the word done but I don't know why its there:
https://gulp.readme.io/docs/gulpseriestasks
Upvotes: 0
Views: 50
Reputation: 19617
done
it's callback which informs the gulp that the task is finished.
Any gulp task can be written by two ways:
gulp.task('default', () {
return gulp
.src(...)
.pipe(anyGulpPlugin())
.dest(...);
});
Or so:
gulp.task('default', done => {
gulp
.src(...)
.pipe(anyGulpPlugin())
.dest(...)
.on('end', done);
});
Upvotes: 1