From 0b241db058d143a022269213c1d8494a36eb9e32 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Tue, 12 Apr 2022 20:57:03 +0530 Subject: [PATCH] Produce a mapping of aliases to resolved colors --- scripts/postcss/css-compile-variables.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/postcss/css-compile-variables.js b/scripts/postcss/css-compile-variables.js index fa584caa..654f1193 100644 --- a/scripts/postcss/css-compile-variables.js +++ b/scripts/postcss/css-compile-variables.js @@ -153,8 +153,13 @@ module.exports = (opts = {}) => { if (opts.compiledVariables){ populateMapWithDerivedVariables(opts.compiledVariables, cssFileLocation); } - // Publish both the base-variables and derived-variables to the other postcss-plugins - const combinedMap = new Map([...baseVariables, ...resolvedMap]); + // Also produce a mapping from alias to completely resolved color + const resolvedAliasMap = new Map(); + aliasMap.forEach((value, key) => { + resolvedAliasMap.set(key, resolvedMap.get(value)); + }); + // Publish the base-variables, derived-variables and resolved aliases to the other postcss-plugins + const combinedMap = new Map([...baseVariables, ...resolvedMap, ...resolvedAliasMap]); result.messages.push({ type: "resolved-variable-map", plugin: "postcss-compile-variables",