svgicon mixin: Don't preload other variants when color is 'universal'

Prevents debug spam due to missing resources.
This commit is contained in:
Abe Jellinek 2024-05-31 11:06:38 -04:00
parent 066eda7315
commit 43779b5e26

View file

@ -1,12 +1,8 @@
@mixin svgicon($icon, $color, $size: "16", $prefix: false, $has2x: false, $light-dark: false) {
background:
-make-icon-background($icon, $color, $size, $prefix, $has2x) no-repeat center/contain,
// Invisible backgrounds to preload all variants:
-make-icon-background($icon, 'white', $size, $prefix, $has2x) center/0,
-make-icon-background($icon, 'light', $size, $prefix, $has2x) center/0,
-make-icon-background($icon, 'dark', $size, $prefix, $has2x) center/0;
@if ($color == 'universal') {
background:
-make-icon-background($icon, $color, $size, $prefix, $has2x) no-repeat center/contain;
@if ($light-dark) {
@include light-dark(fill, nth($light-dark, 1), nth($light-dark, 2));
}
@ -15,6 +11,15 @@
}
-moz-context-properties: fill, fill-opacity;
}
@else {
background:
-make-icon-background($icon, $color, $size, $prefix, $has2x) no-repeat center/contain,
// Invisible backgrounds to preload all variants:
-make-icon-background($icon, 'white', $size, $prefix, $has2x) center/0,
-make-icon-background($icon, 'light', $size, $prefix, $has2x) center/0,
-make-icon-background($icon, 'dark', $size, $prefix, $has2x) center/0;
}
}
@mixin svgicon-menu($icon, $color, $size: "16", $prefix: false, $has2x: false, $light-dark: false) {