lundi 29 décembre 2014

Performance issues with gulp.watch() on directory with ~400 files


I’ve noticed that if I gulp.watch() a directory with ~400 Markdown files, my Gulp task takes a long time to initialize (~19s on my machine). If I remove this specific .watch() call, my task initialization time shrinks to less than 100ms.



gulp.task('my-task', function () {

// these calls are very quick (< 100ms)
gulp.watch('source/styl/*.styl', ['build-css']);
gulp.watch('source/js/index/*.js', ['build-js']);
gulp.watch(['app.js', 'modules/*.js', 'routes/*.js', 'views/*.jade'], [server.run]);
gulp.watch(['source/js/index/*.js', 'app.js', 'modules/*.js', 'routes/*.js', 'gulpfile.js'], ['lint-js']);
gulp.watch('source/img/**/*', ['compress-images']);

// this call takes ~19s to complete
gulp.watch('source/md/releases/*.ms', ['build-releases']);
});


Is there anything I can to to resolve this performance issue, or is watching directories with hundreds of files not feasible in Gulp?





Aucun commentaire:

Enregistrer un commentaire