Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
71
rated 0 times [  76] [ 5]  / answers: 1 / hits: 94039  / 10 Years ago, thu, february 20, 2014, 12:00:00

Here is a composed task I don't know how to replace it with task dependencies.



...
gulp.task('watch', function () {
var server = function(){
gulp.run('jasmine');
gulp.run('embed');
};
var client = function(){
gulp.run('scripts');
gulp.run('styles');
gulp.run('copy');
gulp.run('lint');
};
gulp.watch('app/*.js', server);
gulp.watch('spec/nodejs/*.js', server);
gulp.watch('app/backend/*.js', server);
gulp.watch('src/admin/*.js', client);
gulp.watch('src/admin/*.css', client);
gulp.watch('src/geojson-index.json', function(){
gulp.run('copygeojson');
});
});


The corresponding changelog
https://github.com/gulpjs/gulp/blob/master/CHANGELOG.md#35 [deprecate gulp.run]


More From » gulp

 Answers
4
gulp.task('watch', function () {
var server = ['jasmine', 'embed'];
var client = ['scripts', 'styles', 'copy', 'lint'];
gulp.watch('app/*.js', server);
gulp.watch('spec/nodejs/*.js', server);
gulp.watch('app/backend/*.js', server);
gulp.watch('src/admin/*.js', client);
gulp.watch('src/admin/*.css', client);
gulp.watch('src/geojson-index.json', ['copygeojson']);
});


You no longer need to pass a function (though you still can) to run tasks. You can give watch an array of task names and it will do this for you.


[#72422] Tuesday, February 18, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aden

Total Points: 369
Total Questions: 100
Total Answers: 83

Location: Australia
Member since Tue, Oct 19, 2021
3 Years ago
;