Editor: Add cache-busting for block styles on development mode.
This changeset introduces a development mode for block editor styles. When SCRIPT_DEBUG is enabled, block editor styles now use the file modification time as their version, ensuring cache busting during development. This matches the behavior that already exists for block scripts. Previously, block editor styles only used the version from block.json, which doesn't change during development, causing styles to be cached even after changes. Merges [60355] to the 6.8 branch. Props helgatheviking, abcd95, gziolo, whaze, audrasjb, sandeepdahiya, rollybueno. Fixes #63254. Built from https://develop.svn.wordpress.org/branches/6.8@60434 git-svn-id: http://core.svn.wordpress.org/branches/6.8@59770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -328,8 +328,9 @@ function register_block_style_handle( $metadata, $field_name, $index = 0 ) {
|
||||
$style_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $style_path ) );
|
||||
$style_uri = get_block_asset_url( $style_path_norm );
|
||||
|
||||
$version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false;
|
||||
$result = wp_register_style(
|
||||
$block_version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false;
|
||||
$version = $style_path_norm && defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? filemtime( $style_path_norm ) : $block_version;
|
||||
$result = wp_register_style(
|
||||
$style_handle_name,
|
||||
$style_uri,
|
||||
array(),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.8.2-alpha-60433';
|
||||
$wp_version = '6.8.2-alpha-60434';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user