From: Eavan Date: Mon, 10 Jul 2023 09:56:26 +0000 (+0800) Subject: fix(compiler-sfc): ignore style v-bind in double slash comments (#5409) X-Git-Tag: v3.3.5~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=381b4977af25ba5392704f72ec6b3f2394d87ae7;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-sfc): ignore style v-bind in double slash comments (#5409) --- diff --git a/packages/compiler-sfc/src/style/cssVars.ts b/packages/compiler-sfc/src/style/cssVars.ts index c86dbf2a5b..2380959b81 100644 --- a/packages/compiler-sfc/src/style/cssVars.ts +++ b/packages/compiler-sfc/src/style/cssVars.ts @@ -53,8 +53,9 @@ export function parseCssVars(sfc: SFCDescriptor): string[] { const vars: string[] = [] sfc.styles.forEach(style => { let match - // ignore v-bind() in comments /* ... */ - const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '') + // ignore v-bind() in comments, eg /* ... */ + // and // (Less, Sass and Stylus all support the use of // to comment) + const content = style.content.replace(/\/\*([\s\S]*?)\*\/|\/\/.*/g, '') while ((match = vBindRE.exec(content))) { const start = match.index + match[0].length const end = lexBinding(content, start)