Make WordPress Core

Changeset 60434


Ignore:
Timestamp:
07/08/2025 08:52:24 AM (5 months ago)
Author:
audrasjb
Message:

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.

Location:
branches/6.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.8

  • branches/6.8/src/wp-includes/blocks.php

    r60189 r60434  
    329329    $style_uri       = get_block_asset_url( $style_path_norm );
    330330
    331     $version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false;
    332     $result  = wp_register_style(
     331    $block_version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false;
     332    $version       = $style_path_norm && defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? filemtime( $style_path_norm ) : $block_version;
     333    $result        = wp_register_style(
    333334        $style_handle_name,
    334335        $style_uri,
Note: See TracChangeset for help on using the changeset viewer.