Skip to content

Commit

Permalink
improve the way the vars are defined - props @SergeyBiryukov
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Jun 30, 2022
1 parent 06bb792 commit 80385f0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,9 @@ function gutenberg_register_core_block_assets( $block_name ) {
// else (for development or test) default to use the current time.
$default_version = defined( 'GUTENBERG_VERSION' ) && ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? GUTENBERG_VERSION : time();

$style_path = "build/block-library/blocks/$block_name/style.css";
$editor_style_path = "build/block-library/blocks/$block_name/style-editor.css";
$stylesheet_url = gutenberg_url( $style_path );
$stylesheet_path = gutenberg_dir_path() . $style_path;
$stylesheet_path = is_rtl() ? str_replace( 'style.css', 'style-rtl.css', $stylesheet_path ) : $stylesheet_path;
$style_path = "build/block-library/blocks/$block_name/";
$stylesheet_url = gutenberg_url( $style_path . 'style.css' );
$stylesheet_path = gutenberg_dir_path() . $style_path . ( is_rtl() ? 'style-rtl.css' : 'style.css' );

if ( file_exists( $stylesheet_path ) ) {
wp_deregister_style( "wp-block-{$block_name}" );
Expand Down Expand Up @@ -257,6 +255,7 @@ function() {
}
}

$editor_style_path = "build/block-library/blocks/$block_name/style-editor.css";
if ( file_exists( gutenberg_dir_path() . $editor_style_path ) ) {
wp_deregister_style( "wp-block-{$block_name}-editor" );
wp_register_style(
Expand Down

0 comments on commit 80385f0

Please sign in to comment.