Skip to content

fix(language-plugin-pug): handle backtick attributes containing both quote types#5970

Merged
KazariEX merged 4 commits intovuejs:masterfrom
baptistejamin:master
Feb 19, 2026
Merged

fix(language-plugin-pug): handle backtick attributes containing both quote types#5970
KazariEX merged 4 commits intovuejs:masterfrom
baptistejamin:master

Conversation

@baptistejamin
Copy link
Copy Markdown
Contributor

Hey there :)

When using Pug templates with backtick-quoted attributes containing both single and double quotes, the parser generates invalid HTML that Vue's compiler cannot parse

span(
  :class=`[
    "my-class",
    {
      "my-class--active": (state.type === 'active')
    }
  ]`
)

it ends up with errors such as :

error TS1005: ':' expected.
error TS1005: ',' expected.
error TS1003: Identifier expected.

We noticed this while migrating from vue-pug-plugin to @vue/language-plugin-pug

I tried to address a fix to the lexer and provide some basic tests as well. It's better than nothing :)

Let me know if anything needs to be changed.

@KazariEX KazariEX merged commit dbaa710 into vuejs:master Feb 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants