grunt-express
grunt-express copied to clipboard
livereload overrides existing watches
I'm running an Express server through my own yeoman generator using grunt-express. I set a watch for Stylus files as such
stylus: {
files: ['<%= yeoman.app %>/styles/src/**/*.styl'],
tasks: ['stylus']
},
The stylus task works normally when called.
My issue is when I set livereload to true in my express task, the watch it creates overrides the watch I made for stylus files. In my server logs I can see that the .styl file has been modified, but it just reloads it and never calls the stylus task.
Any help would be appreciated.
I solved my own problem by removing the livereload
option from my grunt-express task and set up my own livereload watch using the livereload
option provided by grunt-watch and adding the livereload script to my webpage. I still think this it's an issue that grunt-express takes precedence over all other watch
calls, but that's just my $0.02.
Yes, indeed. grunt-express
uses grunt-contrib-watch
(by setting up dynamic sub-tasks under watch
) to perform both serverreload
and livereload
. The problem is that grunt-contrib-watch
has this logic that would basically executes queued tasks sequentially, and in our case, the serverreload
creates a watch task that would never complete (so the server can continue running), which blocks other watch tasks. It may take some enhancement from grunt-contrib-watch
side to fix this.
I think it would be good to mention in the readme file that serverreload: true
and livereload: true
are both incompatible with any existing watch tasks. I struggled with this issue quite a bit until I gave up and used grunt-contrib-connect
for live-reloading.
@levjj totally agree, this issue still exists!!!