ScoriaWeb.DevAssetWatcher (scoria v0.1.2)

Copy Markdown View Source

Dev-only watcher that rebuilds the self-contained dashboard asset bundle when source styles/scripts change — so a CSS tweak hot-reloads without manually running mix scoria.assets.build.

Compiled ONLY in :dev (see elixirc_paths/1 in mix.exs) and started via the :dev_children application hook (see config/dev.exs), so it never ships to Hex or runs in an adopter's app.

Flow

edit assets/css/*.css            (you)
  -> this watcher debounces + runs scoria.assets.build
  -> writes priv/static/scoria/app.css
  -> the existing live_reload pattern `priv/static/scoria/.*css` fires
  -> ScoriaWeb.Assets recompiles (it inlines the CSS at compile time)
  -> browser refreshes (when SCORIA_DEV_LIVE_RELOAD=1; see DevEndpoint)

The watcher only regenerates the file — it is harmless to the screenshot harness even when the browser LiveReloader socket is off. The rebuilt bundle lands in priv/static/scoria/, which is NOT a watched dir, so there is no rebuild loop.

On macOS Docker the container's native inotify never sees host fs events, so when FILE_SYSTEM_BACKEND=fs_poll is set (same gate as phoenix_live_reload in config/dev.exs) this watcher uses the polling backend too.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)