gulp-sequence2
v0.1.6
Published
Run a series of gulp tasks or functions in order.
Downloads
15
Readme
gulp-sequence2
A plugin for Gulp allow to write task as a function and combine it in funcitonal style. It usefull for reducing count of gulp tasks.
Install
Install with npm
npm install --save-dev gulp-sequence2
usage
function NamedFunctionTask(cb) {
console.log("Function with callback");
setTimeout(cb, 200);
}
gulp.task("task", (cb) => {
console.log("gulp task");
setTimeout(() => {
cb();
}, 2000);
});
function useSequence2Task(cb) {
console.log("Run task in side by side and parallel:")
seq2(
createTestTask("Sequence 1", 500),
[createTestTask("Parallel 1", 800), createTestTask("Parallel 2", 500)],
createTestTask("Sequence 2", 500)
)(cb);
}
gulp.task("diffenerent-task-type", seq2(
NamedFunctionTask,
() => {
console.log("Task returned stream");
return gulp.src("*");
},
"task",
() => {
return new Promise(function(resolve) {
console.log("Task returned promise")
setTimeout(function() { resolve(); }, 250);
});
},
useSequence2Task
));
}
output
gulp diffenerent-task-type
[18:05:22] Using gulpfile D:\gulp-sequence2\gulpfile.js
[18:05:22] Starting 'diffenerent-task-type'...
[18:05:22] Starting 'NamedFunctionTask'...
Function with callback
[18:05:22] Finished 'NamedFunctionTask'
Task returned stream
[18:05:22] Starting 'task'...
gulp task
[18:05:24] Finished 'task' after 2 s
Task returned promise
[18:05:25] Starting 'useSequence2Task'...
Run task in side by side and parallel:
>Sequence 1
<Sequence 1
>Parallel 1
>Parallel 2
<Parallel 2
<Parallel 1
>Sequence 2
<Sequence 2
[18:05:26] Finished 'useSequence2Task'
[18:05:26] Finished 'diffenerent-task-type' after 4.33 s