class RecompileFrontendAssets

Methods

__construct(Assets $assets, LocaleManager $locales, Dispatcher|null $events = null, SettingsRepositoryInterface|null $settings = null)

No description

void
markDirty()

Flag this asset set as needing a rebuild, without touching the compiled files or their manifest revisions.

void
recompileIfDirty()

Rebuild this asset set in place if it has been flagged dirty, then clear the flag. Runs early in a freshly-booted request — one whose container reflects the current extension state — so the rebuilt output is correct.

string
dirtyKey()

No description

void
recompile()

Rebuild the compiled assets in place.

void
commitAll()

No description

void
flush()

No description

void
flushCss()

No description

void
flushJs()

No description

Details

__construct(Assets $assets, LocaleManager $locales, Dispatcher|null $events = null, SettingsRepositoryInterface|null $settings = null)

Parameters

Assets $assets
LocaleManager $locales
Dispatcher|null $events
SettingsRepositoryInterface|null $settings

void markDirty()

Flag this asset set as needing a rebuild, without touching the compiled files or their manifest revisions.

The rebuild itself is deferred to the next request (see {\Flarum\Frontend\recompileIfDirty}): a request that toggles an extension booted before that extension's extenders were applied, so rebuilding here would bake the old sources — e.g. locale bundles without a newly-enabled extension's keys — into the manifest, and with the revision then matching, nothing would ever rebuild them. Deferring also means nothing is deleted or unset in the meantime: already-served asset URLs keep resolving, and the asset revision token doesn't flicker, so connected clients aren't prompted to reload for a rebuild that may not change anything they load.

Return Value

void

void recompileIfDirty()

Rebuild this asset set in place if it has been flagged dirty, then clear the flag. Runs early in a freshly-booted request — one whose container reflects the current extension state — so the rebuilt output is correct.

Return Value

void

protected string dirtyKey()

Return Value

string

void recompile()

Rebuild the compiled assets in place.

Unlike {\Flarum\Frontend\flush}, nothing is deleted up front: each compiler renders its output and only overwrites the file (and its manifest revision) when the result actually differs. That means there is never a window where an already-served asset URL points at a missing file, and never a gap in the revision manifest that would flicker the asset revision token and fire a spurious "new version available" prompt on connected clients. A rebuild that produces identical output is a complete no-op. {\Flarum\Frontend\Event\AssetsRecompiled} is dispatched once the rebuild has finished, so consumers (e.g. the realtime broadcaster) read a settled revision.

Return Value

void

protected void commitAll()

Return Value

void

void flush()

Return Value

void

protected void flushCss()

Return Value

void

protected void flushJs()

Return Value

void