gulp.parallel
1.1、gulp.parallel(...tasks)

多个任务并行执行。

...ES6的语法,表示把一个数组展开。

示例1:

const gulp = require("gulp");

gulp.task("task1", done => {
    console.log("task1 doing...");
    done();
});
gulp.task("task2", done => {
    console.log("task2 doing...");
    done();
});

gulp.task("default", gulp.parallel("task1", "task2"));

示例2:

const gulp = require("gulp");

const task1 = done => {
    console.log("task1 doing...");
    done();
};

const task2 = done => {
    console.log("task2 doing...");
    done();
};

gulp.task("default", gulp.parallel(task1, task2));

示例3:

const gulp = require("gulp");

const tasks = {
    task1 : done => {
        console.log("task1 doing...");
        done();
    },
    task2 : done => {
        console.log("task2 doing...");
        done();
    }
};

for(const taskName in tasks) {
    gulp.task(taskName, tasks[taskName]);
}

gulp.task("default", gulp.parallel(...Object.keys(tasks)));