I am new to Node,grunt and I use both grunt-contrib-watch and grunt-contrib-connect.
As far as I understand, watch task with livereload = true option reruns the mentioned tasks of the target and refreshes the browser by triggering a livereload server to serve reloaded static files.
However, if browser reload and static file serve happens with just watch task with livereload=true option, why do we need grunt-contrib-connect again for the same job.
- Please explain whether we need connect task still to serve this purpose or is it for something else.
- Did I understand right with regards to achieving the goal with just watch with livereload=true.
Thanks.
The opetion of
livereloadingrunt-contrib-watchis responsible to trigger websocket request to browser to reload the page. It is not a http server. From what i remembergrunt-contrib-connectis simply anHTTP server. Remember thatgrunt-contrib-watchstarts websocket server at port 35736 so add the scriptTo trigger live reload in browser.
Hope this clarifies what you need