Created
October 26, 2015 17:22
-
-
Save dreamyguy/27a3d6e4bca14e0dd475 to your computer and use it in GitHub Desktop.
Running tasks in series, i.e. Task Dependency
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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