Skip to content

Commit 381b497

Browse files
authored
fix(compiler-sfc): ignore style v-bind in double slash comments (#5409)
1 parent d6446a6 commit 381b497

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/compiler-sfc/src/style/cssVars.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ export function parseCssVars(sfc: SFCDescriptor): string[] {
5353
const vars: string[] = []
5454
sfc.styles.forEach(style => {
5555
let match
56-
// ignore v-bind() in comments /* ... */
57-
const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '')
56+
// ignore v-bind() in comments, eg /* ... */
57+
// and // (Less, Sass and Stylus all support the use of // to comment)
58+
const content = style.content.replace(/\/\*([\s\S]*?)\*\/|\/\/.*/g, '')
5859
while ((match = vBindRE.exec(content))) {
5960
const start = match.index + match[0].length
6061
const end = lexBinding(content, start)

0 commit comments

Comments
 (0)