Skip to content

Commit 2e2b657

Browse files
committed
Bundled Themes: Add path data to block theme stylesheets so they can be inlined.
This adds `path` data to the enqueued `style.css`/`style.min.css` stylesheets for the Twenty Twenty-Two and Twenty Twenty-Five themes. These small stylesheets are eligible for inlining, especially after the minification in [60934]. Props westonruter, ankitkumarshah, sabernhardt, poena, joemcgill, spacedmonkey, swissspidy. See #63012. Fixes #63007. git-svn-id: https://develop.svn.wordpress.org/trunk@60935 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b56b386 commit 2e2b657

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/wp-content/themes/twentytwentyfive/functions.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ function twentytwentyfive_enqueue_styles() {
5858
array(),
5959
wp_get_theme()->get( 'Version' )
6060
);
61+
wp_style_add_data(
62+
'twentytwentyfive-style',
63+
'path',
64+
get_parent_theme_file_path( $src )
65+
);
6166
}
6267
endif;
6368
add_action( 'wp_enqueue_scripts', 'twentytwentyfive_enqueue_styles' );

src/wp-content/themes/twentytwentytwo/functions.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ function twentytwentytwo_styles() {
4949
$suffix = SCRIPT_DEBUG ? '' : '.min';
5050
$src = 'style' . $suffix . '.css';
5151

52-
wp_register_style(
52+
wp_enqueue_style(
5353
'twentytwentytwo-style',
5454
get_parent_theme_file_uri( $src ),
5555
array(),
5656
$version_string
5757
);
58-
59-
// Enqueue theme stylesheet.
60-
wp_enqueue_style( 'twentytwentytwo-style' );
58+
wp_style_add_data(
59+
'twentytwentytwo-style',
60+
'path',
61+
get_parent_theme_file_path( $src )
62+
);
6163
}
6264

6365
endif;

0 commit comments

Comments
 (0)