fast-reload
v0.0.1
Published
A quick nodejs + socket powered browser reloader for all your frontend dev needs.
Downloads
3
Readme
Fast Reload 0.0.1
A quick nodejs + socket powered browser reloader for all your frontend dev needs.
Usage
- Install via npm
npm install -g fast-reload
(Make sure to install it globally) - 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:9000");
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>
- Run
fast-reload
from your project directory to start watching for files in the directory it is being run from
Options
$ fast-reload --port 9000 --path /some/other/path/to/watch
$ fast-reload -p 9000 -d /some/other/path/to/watch
Watch Multiple paths
$ fast-reload -d /some/other/path/to/watch -d /some/other/path/to/watch2