fix(sfc/style-vars): should ignore style variable bindings in comments (#4188)
fix #4185
This commit is contained in:
@@ -37,7 +37,9 @@ export function parseCssVars(sfc: SFCDescriptor): string[] {
|
||||
const vars: string[] = []
|
||||
sfc.styles.forEach(style => {
|
||||
let match
|
||||
while ((match = cssVarRE.exec(style.content))) {
|
||||
// ignore v-bind() in comments /* ... */
|
||||
const content = style.content.replace(/\/\*[\s\S]*\*\//g, '')
|
||||
while ((match = cssVarRE.exec(content))) {
|
||||
const variable = match[1] || match[2] || match[3]
|
||||
if (!vars.includes(variable)) {
|
||||
vars.push(variable)
|
||||
|
||||
Reference in New Issue
Block a user