Skip to content

Commit

Permalink
Fix SVG icons on old browsers
Browse files Browse the repository at this point in the history
We were using an `@extend` selector inside a `@supports` condition,
which didn't generate the `@supports` clause as we intended to, so
browsers with no support for mask images were still applying properties
which were meant for browsers with support for mask images.
  • Loading branch information
javierm committed Jun 21, 2021
1 parent 017035c commit d0f8560
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions app/assets/stylesheets/mixins/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
}

%svg-icon {
background: currentcolor;
content: "";
height: 1em;
mask-repeat: no-repeat;
mask-size: 100% 100%;
width: 1em;
@supports (mask-image: url()) {
background: currentcolor;
content: "";
height: 1em;
mask-repeat: no-repeat;
mask-size: 100% 100%;
width: 1em;
}
}

%admin-menu-icon {
Expand All @@ -37,11 +39,8 @@
}
}

@supports (mask-image: url()) {

&::#{$position} {
@extend %svg-icon;
mask-image: image-url("fontawesome/#{$style}/#{$icon}.svg");
}
&::#{$position} {
@extend %svg-icon;
mask-image: image-url("fontawesome/#{$style}/#{$icon}.svg");
}
}

0 comments on commit d0f8560

Please sign in to comment.