Created by: zensh
Hi, @callumacrae I have removed standard coding style as https://github.com/gulpjs/gulp/pull/1462. It is now less changes.
What I bring to gulp here:
support five task type:
- sync task;
- callback task;
- promise task;
- stream task;
- generator task(async/await task later);
Here is generator task will like be:
gulp.task('generator_task', function *() {
yield somePromise;
yield someThunk;
yield gulp.all('a', 'b', 'c');
yield gulp.seq('e', 'f', 'g');
yield gulp.co('h', 'i', ['g', 'k'], 'l');
// others ...
});
tasks compose:
gulp.start('task1', 'task2', ...[, cb])
Run tasks in order. Return thunk function.
// Run 'default' task
gulp.start();
// Run 'default' task with callback
gulp.start(cb);
gulp.start()(cb);
// Run tasks 'a', 'b', 'c' in sequence
gulp.start('a', 'b', 'c');
// with callback
gulp.start('a', 'b', 'c', cb);
gulp.start('a', 'b', 'c')(cb);
// Run tasks 'a', 'b', 'c' in parallel
gulp.start(['a', 'b', 'c']);
// with callback
gulp.start(['a', 'b', 'c'], cb);
gulp.start(['a', 'b', 'c'])(cb);
// Run tasks 'a', then run 'b', 'c' in parallel, then run 'd'
gulp.start('a', ['b', 'c'], 'd');
// with callback
gulp.start('a', ['b', 'c'], 'd', cb);
gulp.start('a', ['b', 'c'], 'd')(cb);
gulp.co('task1', 'task2', ...)
Compose tasks in order. It return thunk function that contain the tasks. The tasks will not run until you call the thunk function.
// Compose tasks 'a', 'b', 'c', tasks will run in sequence
gulp.co('a', 'b', 'c');
// Compose tasks 'a', 'b', 'c', tasks will run in parallel
gulp.co(['a', 'b', 'c']);
// Compose tasks 'a', 'b', 'c', task 'a' will run first, then 'b', 'c' in parallel, then 'd'.
gulp.co('a', ['b', 'c'], 'd');
Define a task with gulp.co
gulp.task('build', gulp.co('a', ['b', 'c'], 'd'));
// run it
gulp.start('build');
gulp.all('task1', 'task2', ...)
Compose tasks in parallel. It return thunk function that contain the tasks. The tasks will not run until you call the thunk function.
// Compose tasks 'a', 'b', 'c', tasks will run in parallel
gulp.all('a', 'b', 'c');
gulp.all(['a', 'b', 'c']);
Define a task with gulp.all
gulp.task('build', gulp.all('a', 'b', 'c'));
// run it
gulp.start('build');
gulp.seq('task1', 'task2', ...)
Compose tasks in sequence. It return thunk function that contain the tasks. The tasks will not run until you call the thunk function.
// Compose tasks 'a', 'b', 'c', tasks will run in sequence
gulp.seq('a', 'b', 'c');
gulp.seq(['a', 'b', 'c']);
Define a task with gulp.seq
gulp.task('build', gulp.seq('a', 'b', 'c'));
// run it
gulp.start('build');