-
-
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: running the same tasks over each other #557
Comments
You can tweak your .watch settings to debounce the events if this happens often https://github.com/shama/gaze#properties |
The tasks are fairly unpredictable in time, and it's hard to make a debounce very fast - I'm just trying to improve the speed that the task executes many times. If that's not possible, that's fine. The ideal solution would be to stop the tasks and restart task B from scratch. |
@avp funny enough, I'm kind off also trying to make the live-reload fire exactly once for a situation where watch executes other tasks, exactly like in your setup. Today I've started a discussion in the livereload plugin (gulp-community/gulp-livereload#36). Playing with debounce settings, as suggested by @contra, is a remedy sometimes but it would be great to have a reliable way of detecting that all the tasks enumerated as |
@robrich Doesn't orchestrator have a concept of "tasks running" to make sure different sets trigger one after another? |
From the quick scanning over the orchestrator code it looks like it will emit the The case where watch would start a new task / sequence of tasks when previous tasks are still in progress seems to be handled as well. So, maybe it would make sense to register a listener on the 'stop' event in |
Yes, orchestrator will ensure a given task is running only once. Do you have a gulpfile that demonstrates this symptom? |
@robrich I think that orchestrator does the right thing - this is more a feature request than a bug report. The whole story started with the quest for a better integration with live-reload. Basically given a setup like this: gulp.watch('src/**/*.js', ['foo', 'bar']); I would like to know when gulp.watch('src/**/*.js', ['foo', 'bar'], function(err){
//Here I know that both 'foo' and 'bar' have finished and they have errored or not
}); But then again, this is more like a feature request for gulp, I believe. |
I think this may be different from my problem, which can be illustrated as follows:
The gulp output order is something like
In the above, |
@phated Thoughts about this for gulp 4? |
@contra this should come out of the box by using |
Article about task-dependency in Gulp: |
Cool - I'll close this since it has been fixed in gulp 4. You can use the gulp4 branch from github for now until we publish |
Nevermind, it's a different isuse |
I'm having some issues with time-consuming tasks that are watched by gulp.
Suppose task B depends on task A (i.e. task A must run before task B). I watch some files, and I run task B when the files change. then, after task A completes and task B is running, I save the files again - this results in task A starting up again, before task B finishes. Then task B never gets rerun with the second save and I have to go back and resave, and wait for gulp to finish running both task A and B again when it would not have been necessary.
Is there a way for gulp to recognize this overlap in dependencies and either ensure that task B always runs after task A or simply restart both tasks on file change?
The text was updated successfully, but these errors were encountered: