Make WordPress Core


Ignore:
Timestamp:
06/16/2023 01:26:34 PM (16 months ago)
Author:
spacedmonkey
Message:

Themes: Inline render blocking CSS `classic-themes.css'

Since [54358], a new CSS file classic-themes.css is enqueued on all pages on the front end of themes without theme.json. This is a blocking http request, the impact on performance will be affected by network conditions. Inlining this style, stops this blocking request. By adding style data of path to the registered style, the function wp_maybe_inline_styles will automatically inline the style for us.

Props spacedmonkey, adamsilverstein.
Fixes #58480.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r55909 r55930  
    37193719        $suffix = wp_scripts_get_suffix();
    37203720        wp_register_style( 'classic-theme-styles', '/' . WPINC . "/css/classic-themes$suffix.css" );
     3721        wp_style_add_data( 'classic-theme-styles', 'path', ABSPATH . WPINC . "/css/classic-themes$suffix.css" );
    37213722        wp_enqueue_style( 'classic-theme-styles' );
    37223723    }
Note: See TracChangeset for help on using the changeset viewer.