Skip to content

Instantly share code, notes, and snippets.

@thecodedrift
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save thecodedrift/9338883 to your computer and use it in GitHub Desktop.

Select an option

Save thecodedrift/9338883 to your computer and use it in GitHub Desktop.
Async Tasks and Orchestrator
// I'm pretty sure this is a bad idea
setImmediate(function() {
gulp.task('later', function() {
gulp.src('**/*.txt')
.pipe(gulp.dest('output/'))
});
});
// but I really want to...
fs.readFile('some-other-tool.json', function(err, data) {
// do stuff with json
gulp.task('build', function() {
gulp.src(myJson.glob)
.pipe(gulp.dest(output));
});
});
// so should I...
gulp.task('build', function(cb) {
fs.readFile('crap-from-java.json', function(err, data) {
// do stuff with json
gulp.src(myJson.glob)
.pipe(gulp.dest(output))
.on('stop', cb); // <== would this work the way I think orchestrator does?
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment