]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-sfc): ignore style v-bind in double slash comments (#5409)
authorEavan <webwwy@gmail.com>
Mon, 10 Jul 2023 09:56:26 +0000 (17:56 +0800)
committerGitHub <noreply@github.com>
Mon, 10 Jul 2023 09:56:26 +0000 (17:56 +0800)
packages/compiler-sfc/src/style/cssVars.ts

index c86dbf2a5b94a521c0de71e9d57c89d3ad9a9733..2380959b81993473c20243df943eca2c6c30ef1b 100644 (file)
@@ -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)