La Famille / Field notes
Execution Log: Zero-Dependency LiveReload
Status: Completed
Actions Taken
- Added
WatchModeflag toconfig.Config(ininternal/config/config.go) to inform downstream logic whether to inject livereload scripts. - Created a minimal Server-Sent Events (SSE) server in
internal/watcher/livereload.go, exportingLiveReloadHandlerandBroadcastReload(). - Updated
internal/watcher/watcher.goto callBroadcastReload()after every successful generator build. - Updated
internal/render/render.goto intercept</body>and inject the vanilla JavaScript SSE listener whenWatchModeis true. - Updated
cmd/la-famille/main.goandcmd/la-famille/tui.goso that the web servers in watch mode usehttp.ServeMuxto serve both the files and the/livereloadendpoint.
Notes
- Relying exclusively on standard library
net/httpmeans zero external dependencies. - The JavaScript payload is resilient; it fails silently if it drops the connection.