Skip to content

Commit

Permalink
Themes: Fix core block style paths on Windows.
Browse files Browse the repository at this point in the history
This is a follow-up to [56528], which normalizes the `BLOCKS_PATH` for Windows prior to making paths relative for caches during the registration process. Prior to this change, incorrect file paths would lead to broken styles for core blocks on Windows.

Props wildworks, pbiron, flixos90, joemcgill.
Fixes #59489. See #59111.


git-svn-id: https://develop.svn.wordpress.org/trunk@56785 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
joemcgill committed Oct 4, 2023
1 parent 89da2ff commit 23c811e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/wp-includes/blocks/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ function register_core_block_style_handles() {

if ( ! $files ) {
$files = glob( wp_normalize_path( BLOCKS_PATH . '**/**.css' ) );

// Normalize BLOCKS_PATH prior to substitution for Windows environments.
$normalized_blocks_path = wp_normalize_path( BLOCKS_PATH );

$files = array_map(
static function ( $file ) {
return str_replace( BLOCKS_PATH, '', $file );
static function ( $file ) use ( $normalized_blocks_path ) {
return str_replace( $normalized_blocks_path, '', $file );
},
$files
);
Expand Down

0 comments on commit 23c811e

Please sign in to comment.