Assets
Blockstudio provides a zero-config asset pipeline for your blocks. Drop CSS, SCSS, or JavaScript files next to your block and they get compiled, minified, and enqueued automatically.
- Registering Assets:File naming conventions and enqueue behavior
- Processing:SCSS compilation, ES module imports, and minification
- Code Field:Inline code editing via the code field type
Inspecting a Block’s Assets
bs_block_assets('theme/card') returns the discovered frontend and editor-canvas
assets of a registered Blockstudio block. Call it after block registration, on init or later.
Unknown blocks, non-Blockstudio blocks, and blocks without assets return [].
The helper does not render the block, enqueue anything, or trigger compilation.
$assets = bs_block_assets('theme/card');
// Each entry has this shape:
[
'type' => 'style',
'handle' => 'blockstudio-theme-card-style-css',
'url' => '/wp-content/blockstudio/cache/.../style-123.css?ver=123',
'inline' => false,
'scope' => ['frontend', 'editor'],
'html' => '<link ...>',
];
typeisstylefor CSS andmodulefor JavaScript. Blockstudio’s file-based JavaScript assets use ES modules, including inline scripts.handleis the stable asset identifier used by Blockstudio’s renderer and theblockstudio/assets/disablefilter. It need not be enqueued in WordPress.urlis the resolved URL of the existing compiled asset, including its version, or the source URL when no compiled file exists. It isnullfor inline assets.inlinedistinguishes inline<style>/<script>output from external files.scopelists the contexts where the asset applies:frontendandeditorfor shared files, and only one for view/editor files.htmlcontains the ready-to-use tag from the normal asset renderer. Inline content, scoped CSS, UI style layers, and render-time disable filters are handled the same way as ordinary block output.
Missing, empty, disabled, and uncompiled SCSS files are omitted. WordPress-enqueued
admin and block-editor parent-document assets are excluded. The list is
limited to the block’s own discovered files. It is not a dependency closure:
nested blocks, code-field values, WordPress-enqueued handles, module CSS imports,
Tailwind, and shared UI/Interactivity runtimes may depend on rendered content.
Use Render::document()
for a complete self-contained preview. Use bs_block_fields() to inspect
the registered field definitions.