-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Task source is fully (re)loaded each time a task i called ? #522
Comments
The issue sounds similar to gruntjs/grunt-contrib-watch#12 which was fixed on grunt-contrib-watch v0.1.4. Although not sure about the persistent variable between task. The new watch task spawns tasks as child processes. I'll play around with grunt-reload to be sure it's not an issue with the watch task. |
This is because of the new watch task. Since the watch spawns tasks as child processes objects won't persist and AFAIK cannot across child processes. I'm not sure about the best way to solve this. One idea is to modify the watch task to have it's core be a lib. In which other tasks can use to be notified of watch events. This way the grunt-reload task can just run one instance and trigger reload on those events. Using My grunt-hub task could also benefit from the core watch becoming a lib as well as it duplicates a lot of the functionality in the watch task. |
Closing. This discussion belongs over at the watch task. |
I've created a project recently based on grunt 0.4.0a & I found something weird after having an issue with grunt-reload.
It seems that since grunt 0.4, the source of a task (tasks/xxx.js) is reloaded each time a task is called.
I' made a stupid test with latest 0.3 & 0.4a and I've different result: I've add a
console.log
just before mygrunt.registerTask()
is called. With 0.3, the log ouputs one time, just when I start grunt. With 0.4, the log outputs each time my task is used.Without asking myself if it's a good evolution or not (I'm new to grunt), who can I store a persistant variable between a task call ? Because on this (live)reload task there is a variable to save the started livereload server.
So with grunt 0.4, how can I update this task to make this object live between task call ?
The text was updated successfully, but these errors were encountered: