An open API service indexing awesome lists of open source software.

https://github.com/synw/streload

Watch static files and reload in the browser on change
https://github.com/synw/streload

Last synced: 2 months ago
JSON representation

Watch static files and reload in the browser on change

Awesome Lists containing this project

README

        

# Static reload

Watch static files and reload in the browser when a change occurs.

## Install

Use go get and build or grab the binary release

## Usage

Add this javascript to the html file you want to reload:

```javascript

(function() {
var conn = new WebSocket("ws://localhost:8042/ws");
conn.onclose = function(evt) {
console.log('Connection closed');
}
conn.onmessage = function(evt) {
window.location.reload();
}
})();

```

Run the watcher:

```
./streload path/to/a/file/or/folder
```

Open the file normaly, it will be reloaded when a change occurs