将gulp.start函数迁移到Gulp v4 [英] Migrate gulp.start function to Gulp v4
问题描述
我一直在将所有gulp v3代码库迁移到v4.但是我被卡在了gulp start函数的位置,在gulp v4中运行gulp start时会抛出错误.
I have been migrating all of my gulp v3 code bases into v4. However I'm stuck at a point where I have gulp start function and it throws me an error when I run gulp start in gulp v4.
这是我在版本3中拥有的功能:
This is the function I had in version 3:
gulp.task('default', ['watch'], function () {
gulp.start('styles', 'scripts', 'images');
});
当迁移到gulp的v4时,我实现了以下功能:
When migrating to v4 of gulp I implemented this function:
gulp.task('default', gulp.parallel('watch', function(done) {
gulp.start('styles', 'scripts', 'images');
done();
}));
如何用新的gulp版本完成相同的过程?我需要在gulp.series
内使用gulp.parallel
吗?
How to accomplish the same process with the new gulp version? Do I need to use gulp.parallel
inside gulp.series
?
推荐答案
将任务更改为函数后,只需使用即可;
After changing your tasks to functions, simply use;
gulp.task('default', gulp.series (watch, gulp.parallel(styles, scripts, images),
function (done) { done(); }
));
首先运行watch函数,然后并行运行样式,脚本和图像函数.
The watch function will run first, then the styles, scripts and images functions in parallel.
组合物的嵌套深度没有强加限制 使用series()和parallel()进行操作.
There are no imposed limits on the nesting depth of composed operations using series() and parallel().
这篇关于将gulp.start函数迁移到Gulp v4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!