|
|
@@ -33,7 +33,7 @@ function genVarName(id: string, raw: string, isProd: boolean): string {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function noramlizeExpression(exp: string) {
|
|
|
+function normalizeExpression(exp: string) {
|
|
|
exp = exp.trim()
|
|
|
if (
|
|
|
(exp[0] === `'` && exp[exp.length - 1] === `'`) ||
|
|
|
@@ -51,7 +51,7 @@ export function parseCssVars(sfc: SFCDescriptor): string[] {
|
|
|
// ignore v-bind() in comments /* ... */
|
|
|
const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '')
|
|
|
while ((match = cssVarRE.exec(content))) {
|
|
|
- const variable = noramlizeExpression(match[1])
|
|
|
+ const variable = normalizeExpression(match[1])
|
|
|
if (!vars.includes(variable)) {
|
|
|
vars.push(variable)
|
|
|
}
|
|
|
@@ -74,7 +74,7 @@ export const cssVarsPlugin: PluginCreator<CssVarsPluginOptions> = opts => {
|
|
|
// rewrite CSS variables
|
|
|
if (cssVarRE.test(decl.value)) {
|
|
|
decl.value = decl.value.replace(cssVarRE, (_, $1) => {
|
|
|
- return `var(--${genVarName(id, noramlizeExpression($1), isProd)})`
|
|
|
+ return `var(--${genVarName(id, normalizeExpression($1), isProd)})`
|
|
|
})
|
|
|
}
|
|
|
}
|