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
- Host: GitHub
- URL: https://github.com/synw/streload
- Owner: synw
- License: mit
- Created: 2018-07-05T08:21:46.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-05T10:06:01.000Z (almost 7 years ago)
- Last Synced: 2025-02-19T12:51:13.630Z (4 months ago)
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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