Created
November 18, 2014 15:43
-
-
Save lukasborawski/528ed7619eaf232385d5 to your computer and use it in GitHub Desktop.
Gulp synchronous tasks running.
This file contains hidden or 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
var gulp = require('gulp'); | |
var async = require('async'); | |
gulp.task('task1', function() { | |
console.log('1'); | |
}); | |
gulp.task('task2', function(cb) { | |
setTimeout(function () { | |
console.log('2'); | |
cb(); | |
}, 1000); | |
}); | |
gulp.task('task3', function() { | |
console.log('3'); | |
}); | |
gulp.task('default', function() { | |
var tasks = ['task1', 'task2', 'task3']; | |
var sync = tasks.map(function(task) { | |
return function(callback) { | |
gulp.run(task, function(err) { | |
callback(err); | |
}); | |
}; | |
}); | |
async.series(sync); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment