Skip to content

Commit

Permalink
fix(compiler-sfc): v-bind using // to comment will still compile
Browse files Browse the repository at this point in the history
  • Loading branch information
eavan5 authored and sxzz committed Jun 10, 2023
1 parent 6277cb9 commit c2d194e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/compiler-sfc/src/style/cssVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ 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)
Expand Down

0 comments on commit c2d194e

Please sign in to comment.