forked from mystiq/hydrogen-web
Format file
This commit is contained in:
parent
92084e8005
commit
b6f5e68e9e
1 changed files with 42 additions and 42 deletions
|
@ -12,7 +12,7 @@ function getValueFromAlias(alias) {
|
||||||
function resolveDerivedVariable(decl, variables) {
|
function resolveDerivedVariable(decl, variables) {
|
||||||
const matches = decl.value.match(RE_VARIABLE_VALUE);
|
const matches = decl.value.match(RE_VARIABLE_VALUE);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
const [,wholeVariable, baseVariable, operation, argument] = matches;
|
const [, wholeVariable, baseVariable, operation, argument] = matches;
|
||||||
if (!variables[baseVariable]) {
|
if (!variables[baseVariable]) {
|
||||||
// hmm.. baseVariable should be in config..., maybe this is an alias?
|
// hmm.. baseVariable should be in config..., maybe this is an alias?
|
||||||
if (!aliasMap.get(`--${baseVariable}`)) {
|
if (!aliasMap.get(`--${baseVariable}`)) {
|
||||||
|
@ -44,7 +44,7 @@ function extractAlias(decl) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addResolvedVariablesToRootSelector( root, variables, { Rule, Declaration }) {
|
function addResolvedVariablesToRootSelector(root, variables, { Rule, Declaration }) {
|
||||||
const newRule = new Rule({ selector: ":root", source: root.source });
|
const newRule = new Rule({ selector: ":root", source: root.source });
|
||||||
// Add base css variables to :root
|
// Add base css variables to :root
|
||||||
for (const [key, value] of Object.entries(variables)) {
|
for (const [key, value] of Object.entries(variables)) {
|
||||||
|
@ -69,7 +69,7 @@ module.exports = (opts = {}) => {
|
||||||
return {
|
return {
|
||||||
postcssPlugin: "postcss-compile-variables",
|
postcssPlugin: "postcss-compile-variables",
|
||||||
|
|
||||||
Once(root, {Rule, Declaration}) {
|
Once(root, { Rule, Declaration }) {
|
||||||
/*
|
/*
|
||||||
Go through the CSS file once to extract all aliases.
|
Go through the CSS file once to extract all aliases.
|
||||||
We use the extracted alias when resolving derived variables
|
We use the extracted alias when resolving derived variables
|
||||||
|
|
Loading…
Reference in a new issue