yuche / vue-strap

Bootstrap components built with Vue.js
http://yuche.github.io/vue-strap/
MIT License
4.71k stars 929 forks source link

Interpolation with non-default templating #202

Open zargold opened 8 years ago

zargold commented 8 years ago

If you are using django or some other backend framework that uses mustache style syntax {{ }} will this work? I noticed that some of the code already includes {{ in the templating. Vue.js allows you to config it with whatever templating you want but here not sure if that is possible. For instance:

delimiters

Type: Array<String>

Default: ["{{", "}}"]

Usage:

// ES6 template string style
Vue.config.delimiters = ['${', '}']
simplesmiler commented 8 years ago

Your backed templating framework most likely provides a way to escape the braces. For example Blade uses @ before the opening brace for that purpose.

zargold commented 8 years ago
simplesmiler commented 8 years ago

You shouldn't really care about the templates of third-party components (e.g. vue-strap), because templates are encapsulated in the components and will not affect your code. And you can always use <span v-text="value"></span> instead of <span>{{ value }}</span> in your code.

Also I have looked it up, and Jango provides {% verbatim %} ... {% endverbatim %} to for escaping.

zargold commented 8 years ago

Thanks for looking that up it would be annoying/difficult to do that but it might be easier to do that I think I would still need to use that verbatim every time I have script and not globally reconfigure my delimiter, because this library assumes that Vue will compile the {{ and Vue will no longer be looking for that... either way I can with not too much re-architecture things so that its always rendered in a partial with the verbatim active.