From 43779b5e2678cc72ef892294340166ea6663e7e9 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Fri, 31 May 2024 11:06:38 -0400 Subject: [PATCH] svgicon mixin: Don't preload other variants when color is 'universal' Prevents debug spam due to missing resources. --- scss/abstracts/_svgicon.scss | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scss/abstracts/_svgicon.scss b/scss/abstracts/_svgicon.scss index 464f28eb78..288da5fe50 100644 --- a/scss/abstracts/_svgicon.scss +++ b/scss/abstracts/_svgicon.scss @@ -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) {