标签:避免 gulp mit doc parallel 运行 javascrip exp require
特性:等待慢的一起输出
const { series } = require('gulp');
function javascript(cb) {
// body omitted
cb();
}
function css(cb) {
// body omitted
cb();
}
exports.build = series(javascript, css);
const { parallel } = require('gulp');
function javascript(cb) {
// body omitted
cb();
}
function css(cb) {
// body omitted
cb();
}
exports.build = parallel(javascript, css);
运行组合操作时,每次提供时都会执行每个任务
如果你有这样的代码
const { series, parallel } = require('gulp');
const clean = function(cb) {
// body omitted
cb();
};
const css = series(clean, function(cb) {
// body omitted
cb();
});
const javascript = series(clean, function(cb) {
// body omitted
cb();
});
exports.build = parallel(css, javascript);
改良后
const { series, parallel } = require('gulp');
function clean(cb) {
// body omitted
cb();
}
function css(cb) {
// body omitted
cb();
}
function javascript(cb) {
// body omitted
cb();
}
exports.build = series(clean, parallel(css, javascript));
详情参考网址
https://gulpjs.com/docs/en/api/parallel
标签:避免 gulp mit doc parallel 运行 javascrip exp require
原文地址:https://www.cnblogs.com/ruange/p/10908289.html