Produce a mapping of aliases to resolved colors

This commit is contained in:
RMidhunSuresh 2022-04-12 20:57:03 +05:30
parent a6b6fef6d2
commit 0b241db058

View file

@ -153,8 +153,13 @@ module.exports = (opts = {}) => {
if (opts.compiledVariables){ if (opts.compiledVariables){
populateMapWithDerivedVariables(opts.compiledVariables, cssFileLocation); populateMapWithDerivedVariables(opts.compiledVariables, cssFileLocation);
} }
// Publish both the base-variables and derived-variables to the other postcss-plugins // Also produce a mapping from alias to completely resolved color
const combinedMap = new Map([...baseVariables, ...resolvedMap]); 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({ result.messages.push({
type: "resolved-variable-map", type: "resolved-variable-map",
plugin: "postcss-compile-variables", plugin: "postcss-compile-variables",