Skip to content
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

Expose event for watch task completion #437

Closed
haroldtreen opened this issue May 20, 2015 · 3 comments
Closed

Expose event for watch task completion #437

haroldtreen opened this issue May 20, 2015 · 3 comments

Comments

@haroldtreen
Copy link

I'm using watch to run build commands when files are changed.

The process takes a while, so if I refresh the browser before it completes I still get back the old files.
This can be confusing because it keeps tricking me into thinking my changes didn't work.

I want to create a middleware for connect to delay requests while watch tasks are running. Looking at the code, it appears watch already has internal events that fire when tasks start and stop.

https://github.com/gruntjs/grunt-contrib-watch/blob/master/tasks/watch.js#L31-L46

I would like to expose these events by either passing them up through grunt, or exposing a way to specify callbacks in the watch config. I believe this functionality could be useful in other situations other then my own.

Is that a feature that could be easily added, or would be possible to merge if I wrote it myself?

Thanks!

@eddiemonge
Copy link
Contributor

why not incorporate livereload or something else that will refresh the page once the changes are done instead of doing it manually?

@haroldtreen
Copy link
Author

Thanks for the reply Eddie!

Some people have been using live reload, but it's not something we have set-up out of box for everyone.

The build process can take a while after files are saved. People not used to live reload still switch to the browser and expect to see their changes right away after the refresh.

We've been using the events in a forked version and it's helped reduce the confusion.

Let me know if you have any other concerns or things I can help with!

@eddiemonge
Copy link
Contributor

That sounds more like a training issue than a technical one. Just tell them the page will automatically reload once its ready to. Or do something to speed up the time between changes going in and the build finishing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants