Match regex only if declaration is a variable

This commit is contained in:
RMidhunSuresh 2022-03-10 17:24:32 +05:30
parent ff10297bf8
commit 9f77df0bff

View file

@ -55,11 +55,13 @@ function resolveDerivedVariable(decl, {variables, derive}) {
}
function extractAlias(decl) {
if (decl.variable) {
const wholeVariable = decl.value.match(/var\(--(.+)\)/)?.[1];
if (decl.prop.startsWith("--") && wholeVariable) {
if (wholeVariable) {
aliasMap.set(decl.prop, wholeVariable);
}
}
}
function addResolvedVariablesToRootSelector(root, variables, {Rule, Declaration}) {
const newRule = new Rule({ selector: ":root", source: root.source });