Skip to content

Commit

Permalink
fix (optimize css): mobile styles can override tablet styles (#3346)
Browse files Browse the repository at this point in the history
Happens if the very first style encountered in the editor is a mobile style. fixes #3345

Co-authored-by: [email protected] <>
  • Loading branch information
bfintal authored Oct 8, 2024
1 parent 8e29e60 commit de4cb54
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/css-optimize.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ public static function generate_css( $styles ) {

foreach ( $style_matches[1] as $i => $media_query ) {
$media_query = ! empty( $media_query ) ? substr( $media_query, 0, -1 ) : $media_query;
$media_query = str_replace( 'width: ', 'width:', $media_query ); // Ensure that the media query is consistent.
$selector = $style_matches[2][ $i ];
$style_rule = $style_matches[3][ $i ];

Expand Down

0 comments on commit de4cb54

Please sign in to comment.