Skip to content
Corex

Assets

Corex\Assets\Assets · class · Core layer

The resolution root for the asset facades (spec 062). Resolves the shared {@see AssetRegistry} from the container (the framework boundary, like {@see \Corex\Support\Facades\Config}). Tests swap in a fake registry via {@see swap()} so the facades can be exercised without booting WP.

registerBase(string $name, string $dir, string $url, string $fallbackVersion, bool $asDefault): AssetManager

Section titled “registerBase(string $name, string $dir, string $url, string $fallbackVersion, bool $asDefault): AssetManager”

Register an asset base for a theme/plugin/client in one call (spec 062), so its assets can be enqueued/rendered with the facades: Assets::registerBase('acme', $dir, $url, $version) then Style::enqueue('acme-main', 'css/main.css', ['base' => 'acme']). Reads a build/manifest.json under $dir when present; the version resolves per environment (filemtime in dev, manifest hash in production, $fallbackVersion otherwise).

Test seam: force the registry the facades resolve (null restores container resolution).