|
|
@@ -12,8 +12,7 @@ import { PluginCreator } from 'postcss'
|
|
|
import hash from 'hash-sum'
|
|
|
|
|
|
export const CSS_VARS_HELPER = `useCssVars`
|
|
|
-export const cssVarRE =
|
|
|
- /\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g
|
|
|
+export const cssVarRE = /\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g
|
|
|
|
|
|
export function genCssVarsFromList(
|
|
|
vars: string[],
|
|
|
@@ -38,7 +37,7 @@ export function parseCssVars(sfc: SFCDescriptor): string[] {
|
|
|
sfc.styles.forEach(style => {
|
|
|
let match
|
|
|
// ignore v-bind() in comments /* ... */
|
|
|
- const content = style.content.replace(/\/\*[\s\S]*\*\//g, '')
|
|
|
+ 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)) {
|