I have the following configuration:
// Watch
gulp.task('watch', function () {
gulp.watch('_01_src/js/**/*.js', ['babel']);
gulp.watch('_01_src/scss/**/*.scss', ['scss']);
});
gulp.task('default', ['scss', 'babel', 'watch']);
If I execute watch alone: "gulp watch" is working with no issue. If I execute "gulp", watch is started but is not working and I don't understand why (I tried changing the position in array but no luck).
In your example, it runs scss
, babel
and watch
asynchronously, that could cause problems. Maybe just set scss
and babel
to run before watch
is started at all?
// Watch
gulp.task('watch', ['scss', 'babel'], function () {
gulp.watch('_01_src/js/**/*.js', ['babel']);
gulp.watch('_01_src/scss/**/*.scss', ['scss']);
});
gulp.task('default', ['watch']);