Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Opt-in to print styles for rendered blocks only and inlining them
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Oct 7, 2021
1 parent 2cb7532 commit 9c4896c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ function twentytwentytwo_support() {
function twentytwentytwo_scripts() {
// Enqueue theme stylesheet.
wp_enqueue_style( 'twentytwentytwo-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
// Add "path" data to the stylesheet to allow inlining it when possible in order to improve perfrormance.
wp_style_add_data( 'twentytwentytwo-style', 'path', get_template_directory() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'twentytwentytwo_scripts' );

Expand All @@ -35,4 +37,7 @@ function twentytwentytwo_editor_styles() {
)
);
}
add_action( 'admin_init', 'twentytwentytwo_editor_styles' );
add_action( 'admin_init', 'twentytwentytwo_editor_styles' );

// Opt-in to only load styles for rendered blocks.
add_filter( 'should_load_separate_core_block_assets', '__return_true' );

0 comments on commit 9c4896c

Please sign in to comment.