Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom delimiters #3363

Open
1 task done
athewsey opened this issue Feb 28, 2022 · 0 comments
Open
1 task done

Support custom delimiters #3363

athewsey opened this issue Feb 28, 2022 · 0 comments

Comments

@athewsey
Copy link

  • I have searched through existing issues

Feature Request

I'm working on a Vue v3 project using custom delimiters to avoid conflicting with a (Shopify Liquid) server-side templating language that relies on handlebars {{ and }} already.

So far, my only configuration for this has been to set the option in vite.config.ts and everything seems to be working pretty much okay:

export default defineConfig({
  ...,
  plugins: [
    vue({
      template: {
        compilerOptions: {
          delimiters: ["${", "}"],
          ...,
        },
      },
    }),
  ],
});

...But I notice the syntax highlighting in my component .vue files doesn't seem to be aware of the setting and couldn't see any mentions in the Vetur guide.

Maybe there's some way to work around this already that I'm missing? Or else would be nice if a configuration could be added.

For what it's worth I'm not particularly tied to the choice of "${", "}", and appreciate there might be some edge cases that make that a particularly tricky case? Like this for example combining a style binding (normal JS ${}) with a Vue template HTML substitution (Vue ${}):

<div
  class="confidence-bar"
  :style="{
    background: 
      `linear-gradient(90deg, rgba(255, 0, 0, 1.0) 0%, rgba(255, 0, 0, 1.0) ${
        confidence * 100
      }%, rgba(255, 0, 0, 0.5) ${
        confidence * 100
      }%, rgba(255, 0, 0, 0.5) 100%)`
    }"
  >
  ${ Math.round(confidence * 1000) / 10 }%
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants