Skip to content
Corex

Script

Corex\Assets\Script · class · Core layer

Enqueue/register a source-controlled script by its base-relative path (spec 062), resolving the URL + version through the {@see AssetManager}. Supports frontend/admin/editor/block scripts, dependencies, footer placement, a loading strategy (defer/async), ES module type, and an explicit version — and merges a sibling WordPress *.asset.php build record (its dependencies + version) when present (wp-scripts emits one next to the built file). Corex\Assets\Script::enqueue(‘client-app’, ‘js/app.js’, [‘defer’ => true, ‘in_footer’ => true]); Corex\Assets\Script::enqueueModule(‘client-module’, ‘js/module.js’);

enqueue(string $handle, string $relative, array $options): bool

Section titled “enqueue(string $handle, string $relative, array $options): bool”

enqueueModule(string $handle, string $relative, array $options): bool

Section titled “enqueueModule(string $handle, string $relative, array $options): bool”

Enqueue an ES module (<script type="module">).