Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add RTL styles
  • Loading branch information
aristath committed Oct 7, 2021
commit 46f29f505cebb5b496812dd7869cd5b6cece0d73
12 changes: 12 additions & 0 deletions lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,18 @@ function gutenberg_enqueue_block_style( $block_name, $args ) {
// Add `path` data if provided.
if ( isset( $args['path'] ) ) {
wp_style_add_data( $args['handle'], 'path', $args['path'] );

// Get the RTL file path.
$rtl_file_path = str_replace( '.css', '-rtl.css', $args['path'] );

// Add RTL stylesheet.
if ( file_exists( $rtl_file_path ) ) {
wp_style_add_data( $args['hanle'], 'rtl', 'replace' );

if ( is_rtl() ) {
wp_style_add_data( $args['handle'], 'path', $rtl_file_path );
}
}
}

// Enqueue the stylesheet.
Expand Down