-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gulp.watch()
and the initial run
#1372
Comments
When I understand your problem correctly, maybe this would help you: gulp.task('watch', ['task.before.watch'], function() {
return gulp.watch(['src/**/*.js', 'test/**/*.js'], ['test.unit']);
}); With this code, all tasks in the square brackets will start before the watch task. |
Not really. My gulp.task('watch', function() {
failOnError = false; // Don't process.exit() on errors.
gulp.start(['test.unit']); // Trigger initial build.
return gulp.watch(['src/**/*.ts', 'test/**/*.ts', 'test_files/**'], ['test.unit']);
}); So if I have a task start before it, I'll never even make it to the |
Okay, why does it fail, I use a similar watch task and everything runs like a charm |
I solved this by using a flag like I don't think it would be a good idea to add this option, it is a very, very specific case. I think the solution would be even easier in Gulp 4 as you can just call the function, too. |
I think this is a super common use case.
Sure, you can pass This should be default behaviour, or easy to achieve, without any hacks. It's the whole point, after all ;-) |
3.x is feature locked and the file watcher is completely different in 4.0 where we just wrap chokidar. We don't want to add extra functionality on top of chokidar. |
It'd be nice to allow starting an initial run for a gulp watch, e.g.:
Currently the only way to achieve this is to manually trigger a
gulp.start
, which is undocumented and thus a bit ugly.The text was updated successfully, but these errors were encountered: