NAME
BarefootJS::DevReload - Framework-agnostic dev-only browser auto-reload for BarefootJS apps
SYNOPSIS
# Plain PSGI / Plack (e.g. the Text::Xslate backend)
use BarefootJS::DevReload;
# Mount the SSE endpoint (dev only):
my $reload = BarefootJS::DevReload->to_app(dist_dir => 'dist');
# ... route '/_bf/reload' => $reload ...
# And emit the browser snippet before </body> in your layout:
BarefootJS::DevReload->snippet('/_bf/reload');
DESCRIPTION
Companion to barefoot build --watch in @barefootjs/cli. The CLI drops <dist>/.dev/build-id after every successful rebuild that changed output; a browser snippet subscribes to an SSE endpoint that emits event: reload when that file changes, so an editor save triggers an automatic reload.
This module holds the engine-agnostic pieces — the browser snippet, the build-id reader, and a ready-made PSGI streaming app for the SSE endpoint — so both Mojolicious::Plugin::BarefootJS::DevReload (Mojo streaming) and plain PSGI/Plack hosts (the Text::Xslate backend) share one implementation.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 33:
Non-ASCII character seen before =encoding in '—'. Assuming UTF-8