Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gutenberg Plugin: Correctly enqueue core block theme styles #54936

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,17 +293,18 @@ static function () {

// If the file exists, enqueue it.
if ( file_exists( gutenberg_dir_path() . $theme_style_path ) ) {

wp_deregister_style( "wp-block-{$block_name}-theme" );
if ( file_exists( $stylesheet_path ) ) {
// If there is a main stylesheet for this block, append the theme styles to main styles.
// If there is a main stylesheet for this block, deregister the core theme
// styles and append the theme styles to main styles.
wp_add_inline_style(
"wp-block-{$block_name}",
file_get_contents( gutenberg_dir_path() . $theme_style_path )
);
} else {
// If there is no main stylesheet for this block, register theme style.
wp_register_style(
"wp-block-{$block_name}",
"wp-block-{$block_name}-theme",
gutenberg_url( $theme_style_path ),
array(),
$default_version
Expand Down
Loading