Last active
December 24, 2015 18:09
-
-
Save cristiangrojas/6841184 to your computer and use it in GitHub Desktop.
Reload grunt when Gruntfile.js or package.json changed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Meanwhile, a workaround is to restart watch when Gruntfile.js is modified. Here is a quick hack to do it. | |
Set the "nospawn" option of watch to true. | |
Add the following task in your Gruntfile.js: | |
grunt.registerTask('exit', 'Just exits.', function() { | |
process.exit(0); | |
}); | |
Put this as a target of your watch: | |
watch: { | |
config: { | |
files: ['package.json', 'gruntfile.js'], | |
tasks: ['exit'] | |
} | |
} | |
And finally you run this in your terminal: | |
while true; do grunt watch; echo -e "\nRESTART"; done | |
Note: you will need to close your terminal to stop watch. (Or do a ctrl-z followed by kill %1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment