Match regex only if declaration is a variable
This commit is contained in:
parent
ff10297bf8
commit
9f77df0bff
1 changed files with 5 additions and 3 deletions
|
@ -55,10 +55,12 @@ function resolveDerivedVariable(decl, {variables, derive}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractAlias(decl) {
|
function extractAlias(decl) {
|
||||||
|
if (decl.variable) {
|
||||||
const wholeVariable = decl.value.match(/var\(--(.+)\)/)?.[1];
|
const wholeVariable = decl.value.match(/var\(--(.+)\)/)?.[1];
|
||||||
if (decl.prop.startsWith("--") && wholeVariable) {
|
if (wholeVariable) {
|
||||||
aliasMap.set(decl.prop, wholeVariable);
|
aliasMap.set(decl.prop, wholeVariable);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addResolvedVariablesToRootSelector(root, variables, {Rule, Declaration}) {
|
function addResolvedVariablesToRootSelector(root, variables, {Rule, Declaration}) {
|
||||||
|
|
Reference in a new issue