Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • G gulp
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gulp
  • gulp
  • Merge requests
  • !1463

refactor version for tasks compose

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/zensh/thunk-gulp into master Dec 29, 2015
  • Overview 9
  • Commits 1
  • Pipelines 0
  • Changes 5

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:

  1. sync task;
  2. callback task;
  3. promise task;
  4. stream task;
  5. 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');
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/zensh/thunk-gulp