A quick nodejs + socket powered browser reloader for all your frontend dev needs.
JavaScript
Switch branches/tags
Nothing to show
Latest commit 6bbd1e8 Oct 22, 2012 @rowoot added multiple dirs
Permalink
Failed to load latest commit information.
bin using fs.notify instead of watchr Oct 14, 2012
lib added multiple dirs Oct 22, 2012
.gitignore first commit Sep 25, 2012
LICENSE added port, dir Sep 25, 2012
README.md added multiple dirs Oct 22, 2012
TODOS.md added multiple dirs Oct 22, 2012
package.json added multiple dirs Oct 22, 2012

README.md

Node Live Reload 0.3

A quick nodejs + socket powered browser reloader for all your frontend dev needs.

Usage

  1. Install via npm npm install -g node-live-reload (Make sure to install it globally)
  2. Add the following js to your project
<!-- Make sure to remove this in production -->
<!-- include it above the </body> tag -->
<script>
var ws;
function socket() {
  ws = new WebSocket("ws://127.0.0.1:8080");
  ws.onmessage = function ( e ) {
    var data = JSON.parse(e.data);
    if ( data.r ) {
      location.reload();
    }
  };
}
setInterval(function () {
  if ( ws ) {
    if ( ws.readyState !== 1 ) {
      socket();
    }
  } else {
    socket();
  }
}, 1000);
</script>
  1. Run node-live-reload from your project directory to start watching for files in the directory it is being run from

Options

$ node-live-reload --port 9000 --path /some/other/path/to/watch
$ node-live-reload -p 9000 -d /some/other/path/to/watch

Watch Multiple paths

$ node-live-reload -d /some/other/path/to/watch -d /some/other/path/to/watch2