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

Allow themes to add inline styles for all blocks when using lazy styles loading #32275

Merged
merged 7 commits into from
Jun 8, 2021
Merged
Next Next commit
register empty styles for blocks that don't have any
  • Loading branch information
aristath committed Jun 8, 2021
commit a22c3cd8509f8601783f2801cd121d6552d35a4a
2 changes: 2 additions & 0 deletions lib/blocks.php
Original file line number Diff line number Diff line change
@@ -187,6 +187,7 @@ function gutenberg_register_core_block_styles( $block_name ) {
$style_path = "build/block-library/blocks/$block_name/style.css";
$editor_style_path = "build/block-library/blocks/$block_name/style-editor.css";

wp_register_style( "wp-block-{$block_name}", false );
if ( file_exists( gutenberg_dir_path() . $style_path ) ) {
wp_deregister_style( "wp-block-{$block_name}" );
wp_register_style(
@@ -201,6 +202,7 @@ function gutenberg_register_core_block_styles( $block_name ) {
wp_style_add_data( "wp-block-{$block_name}", 'path', gutenberg_dir_path() . $style_path );
}

wp_register_style( "wp-block-{$block_name}-editor" );
if ( file_exists( gutenberg_dir_path() . $editor_style_path ) ) {
wp_deregister_style( "wp-block-{$block_name}-editor" );
wp_register_style(