I\'m editing an HTML file in Vim and I want the browser to refresh whenever the file underneath changes.
Is there a plugin for Google Chrome that will listen for ch
I assume you're not on OSX? Otherwise you could do something like this with applescript:
http://brettterpstra.com/watch-for-file-changes-and-refresh-your-browser-automatically/
There is also a plugin for chrome called "auto refresh plus" where you can specify a reload every x seconds:
https://chrome.google.com/webstore/detail/auto-refresh-plus/oilipfekkmncanaajkapbpancpelijih?hl=en
I know this is an old question but in case it helps someone, there is a reload npm package that solves it.
In case that you are not running it on a server or have received the error Live.js doesn't support the file protocol. It needs http.
Just install it:
npm install reload -g
and then at your index.html directory, run:
reload -b
It will start a server that will refresh every time you save your changes.
There are many other options in case you're running it on the server or anything else. Check the reference for more details!
In node.js, you can wire-up primus.js (websockets) with gulp.js + gulp-watch (a task runner and change listener, respectively), so that gulp lets your browser window know it should refresh whenever html, js, etc, change. This is OS agnostic and I have it working in a local project.
Here, the page is served by your web server, not loaded as a file from disk, which is actually more like the real thing.
Offline solution using R
This code will:
make the browser refresh everytime a change is saved to the .html-file.
install.packages("servr") servr::httw(dir = "c:/users/username/desktop/")
Similar solutions exist for python etc.
Handy Bash one-liner for OS X, assuming that you have installed fswatch (brew install fswatch
). It watches an arbitrary path/file and refreshes the active Chrome tab when there are changes:
fswatch -o ~/path/to/watch | xargs -n1 -I {} osascript -e 'tell application "Google Chrome" to tell the active tab of its first window to reload'
See more about fswatch here: https://stackoverflow.com/a/13807906/3510611
http://livereload.com/ - native app for OS X, Alpha version for Windows. Open sourced at https://github.com/livereload/LiveReload2