[wp-trac] [WordPress Trac] #58519: Inline styles block styles in bundled classic themes

WordPress Trac noreply at wordpress.org
Thu Oct 16 22:56:16 UTC 2025


#58519: Inline styles block styles in bundled classic themes
---------------------------+-----------------------------
 Reporter:  spacedmonkey   |       Owner:  (none)
     Type:  enhancement    |      Status:  reopened
 Priority:  normal         |   Milestone:  Future Release
Component:  Bundled Theme  |     Version:  5.8
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:  performance
---------------------------+-----------------------------
Changes (by westonruter):

 * keywords:  has-patch => needs-patch


Old description:

> In [50836] function was added, to inline block styles, so for better
> performance. There are a number of small stylesheets in bundled themes
> that could do with that could use this functionality. To opt-in a
> stylesheet, simply add the path add an extra piece of data of the
> stylesheet. Like this.
>
> {{{#!php
> wp_enqueue_style( 'twentyfifteen-block-style',
> get_template_directory_uri() . '/css/blocks.css', array( 'twentyfifteen-
> style' ), '20230122' );
> wp_style_add_data( 'twentyfifteen-block-style', 'path',
> get_template_directory() . '/css/blocks.css' );
> }}}
>
> This could improve FE performance, as it remove a blocking request.
>
> Blocked by: #63012

New description:

 In [50836] function was added, to inline block styles, so for better
 performance. There are a number of small stylesheets in bundled themes
 that could do with that could use this functionality. To opt-in a
 stylesheet, simply add the path add an extra piece of data of the
 stylesheet. Like this.

 {{{#!php
 wp_enqueue_style( 'twentyfifteen-block-style',
 get_template_directory_uri() . '/css/blocks.css', array( 'twentyfifteen-
 style' ), '20230122' );
 wp_style_add_data( 'twentyfifteen-block-style', 'path',
 get_template_directory() . '/css/blocks.css' );
 }}}

 This could improve FE performance, as it remove a blocking request.

 Blocked by:

 * #64109

--

Comment:

 I've opened #64109 to add minification for stylesheets in bundled classic
 themes. This is a blocker for being able to inline the classic themes'
 block styles.

 On a related note, with #64099 we should be able to load block styles on
 demand in classic themes via template enhancement output buffer. This
 being the case, we should break up the `blocks.css` used in classic themes
 into a separate stylesheet for each block. These can then be attached as
 inline scripts for the underlying block-specific stylesheet, when
 stylesheets are being loaded on demand (i.e. when
 `wp_should_load_block_assets_on_demand()` returns true).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58519#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list