Pass result as message
This commit is contained in:
parent
66304ed7e0
commit
e8bd1f3390
1 changed files with 8 additions and 1 deletions
|
@ -112,7 +112,7 @@ module.exports = (opts = {}) => {
|
|||
return {
|
||||
postcssPlugin: "postcss-compile-variables",
|
||||
|
||||
Once(root, {Rule, Declaration}) {
|
||||
Once(root, {Rule, Declaration, result}) {
|
||||
/*
|
||||
Go through the CSS file once to extract all aliases and base variables.
|
||||
We use these when resolving derived variables later.
|
||||
|
@ -120,6 +120,13 @@ module.exports = (opts = {}) => {
|
|||
root.walkDecls(decl => extract(decl));
|
||||
root.walkDecls(decl => resolveDerivedVariable(decl, opts.derive));
|
||||
addResolvedVariablesToRootSelector(root, {Rule, Declaration});
|
||||
// Publish both the base-variables and derived-variables to the other postcss-plugins
|
||||
const combinedMap = new Map([...baseVariables, ...resolvedMap]);
|
||||
result.messages.push({
|
||||
type: "resolved-variable-map",
|
||||
plugin: "postcss-compile-variables",
|
||||
colorMap: combinedMap,
|
||||
})
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
Reference in a new issue