Skip to content

Cannot write Mustache syntax in template #698

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

Closed
ulivz opened this issue Dec 27, 2017 · 1 comment
Closed

Cannot write Mustache syntax in template #698

ulivz opened this issue Dec 27, 2017 · 1 comment

Comments

@ulivz
Copy link
Member

ulivz commented Dec 27, 2017

Did the vue init command itself result in an error?

  • No.

Actual result:

  • I try to write mustache syntax {{ ... }} at my .vue component file. the hbs render engine will transform it as hbs element. and even if the var is not defined, vue-cli will not throw error:
{{ a.b }}  <!-- Will be transformed to empty, and doesn't throw error -->

Expected result:

vue-cli should rewrite the transform function to add extra syntax to distinguish hbs-mustache token and vue-mustache token. And when customized template try to use non-existed variable, vue-cli should throw error.

@LinusBorg
Copy link
Member

We are currently not planning to mess with the handlebars defaults, at least not in the 2.* version of vue-cli. There's alreadya request for this though: #546

So for now:

  1. You can escape those easily:
  <h1>\{{message}}</h1>

We do that in our templates as well, see here.

  1. You can make the vue-cli skip interpolation for some files in your own templates: https://github.com/vuejs/vue-cli#skip-rendering

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

No branches or pull requests

2 participants