Migrate gulp.start function to Gulp v4(将 gulp.start 函数迁移到 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.
来自 gulp.series 文档:
组合的嵌套深度没有强加限制使用 series() 和 parallel() 进行操作.
There are no imposed limits on the nesting depth of composed operations using series() and parallel().
这篇关于将 gulp.start 函数迁移到 Gulp v4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 gulp.start 函数迁移到 Gulp v4


- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 400或500级别的HTTP响应 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01