From 2dd655cd9ab9b4aef111061eff6ca1a3270b839b Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Mon, 4 Apr 2022 12:10:54 +0530 Subject: [PATCH] Check if icon is in shared var --- scripts/postcss/css-url-to-variables.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/postcss/css-url-to-variables.js b/scripts/postcss/css-url-to-variables.js index 598ac973..4480a2b8 100644 --- a/scripts/postcss/css-url-to-variables.js +++ b/scripts/postcss/css-url-to-variables.js @@ -55,7 +55,8 @@ function addResolvedVariablesToRootSelector(root, { Rule, Declaration }) { function populateMapWithIcons(map, cssFileLocation) { const location = cssFileLocation.match(/(.+)\/.+\.css/)?.[1]; - if (map.has(location)) { + const sharedObject = map.get(location); + if (sharedObject?.["icon"]) { /** * This postcss plugin is going to run on all theme variants of a single theme. * But we only really need to populate the map once since theme variants only differ @@ -63,7 +64,7 @@ function populateMapWithIcons(map, cssFileLocation) { */ return; } - map.set(location, { "icon": Object.fromEntries(urlVariables) }); + map.set(location, { ...sharedObject, "icon": Object.fromEntries(urlVariables) }); } /* *