[wp-trac] [WordPress Trac] #60163: Block editor admin assets should use asset file version when in debug/local mode
WordPress Trac
noreply at wordpress.org
Thu Dec 28 15:08:56 UTC 2023
#60163: Block editor admin assets should use asset file version when in debug/local
mode
----------------------------+-----------------------------
Reporter: helgatheviking | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version:
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
Admin assets defined in block.json are enqueued in the editor with the
version property from block.json of if not defined, the version of
WordPress. [source](https://github.com/WordPress/wordpress-
develop/blob/455044e6261e64970fb9039dba52ceb47290a634/src/wp-
includes/blocks.php#L273)
That's fine for plugin release, but for development it means you can build
a block using the [create block script](https://developer.wordpress.org
/block-editor/reference-guides/packages/packages-create-block/), run `npm
run start` and the editor ''style'' assets get compiled correctly as you
work but the browser keeps showing the cached version stylesheet. Editor
scripts however, [pull a version from the
`index.asset.php`](https://github.com/WordPress/wordpress-
develop/blob/455044e6261e64970fb9039dba52ceb47290a634/src/wp-
includes/blocks.php#L194) so it's always refreshed on page reload.
I'd love to see the order go something like:
If dev mode (either `WP_DEVELOPMENT_MODE` or `WP_ENVIRONMENT_TYPE`
constants then use the version of `index.asset.php`.
If ''not'' dev mode, use the version from the block.json file.
Finally, default to the version of WordPress.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60163>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list