Skip to content

Instantly share code, notes, and snippets.

@dreamyguy
Created October 26, 2015 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dreamyguy/27a3d6e4bca14e0dd475 to your computer and use it in GitHub Desktop.
Save dreamyguy/27a3d6e4bca14e0dd475 to your computer and use it in GitHub Desktop.
Running tasks in series, i.e. Task Dependency
// ref: https://github.com/gulpjs/gulp/blob/master/docs/recipes/running-tasks-in-series.md
// ----------- method 1 ----------- //
gulp.task('2', ['1'], function() {
var stream = gulp.src()
// do some concatenation, minification, etc.
.pipe(gulp.dest());
return stream; // return the stream as the completion hint
});
gulp.task('3', ['1'], function() {
var stream = gulp.src()
// do some concatenation, minification, etc.
.pipe(gulp.dest());
return stream;
});
gulp.task('3', ['1', '2']);
gulp.task('4', ['3']);
// ----------- method 2 ----------- //
gulp.task('2', ['1'], function() {
// task '1' is done now
});
gulp.task('3', ['1', '2']); // 1, 2 is syntax sugar, since only 2 is necessary
gulp.task('4', ['1', '2', '3']); // 1, 2, 3 is syntax sugar, since only 3 is necessary
// -------------------------------- //
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment