Documentation
¶
Overview ¶
package devf provides livereload webserver for developers (inspired by devd). It attempts to do one thing and do it well: serve as a reverse proxy while injecting some JS to support livereloading.
The livereload is triggered by a std-input newline or some OS-signals (usually provided by another tool).
Usage:
devf [options] http-url-or-local-folder
If `http-url-or-local-folder` contains `://`, it will be interpreted as a URL, otherwise as a local folder.
The flags are:
-addr string address to listen to (default ":8080") -sig value comma-separated list of signals which will trigger a reload (instead of stdin newline): abrt,hup,int,kill,pipe,quit,term,usr1,usr2
Example using inotifywait on linux ¶
inotifywait -m -e close_write **/*.go | \ xargs -n1 -d "\n" vanitydoc -html=dist/devf gitea://codeberg.org/pfad.fr/devf | \ devf dist
Explanation:
- on any change to a go file (using inotifywait),
- re-generates the package documentation (using xargs and vanitydoc),
- serve the content of `dist` and automatically reloads the webbrowser using devf
Example using modd ¶
**/*.gohtml server.is_running { daemon: devf -sig hup http://localhost:8989 }
modd will send a sighup to devf (which will trigger a reload) whenever a .gohtml file changes or the `server.is_running` file is written to (I usually do that in my main.go, when the server is ready to accept connections).
Advanced usage ¶
If you need more control regarding the triggering of the reload, the reverse-proxying or of the local server, take a look at the livereload subpackage.
Directories
¶
Path | Synopsis |
---|---|
package livereload handles Server-sent events and injection of the livereload script into upstream HTML pages.
|
package livereload handles Server-sent events and injection of the livereload script into upstream HTML pages. |