Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue and Django mustache templating conflict

I am planning to do a project with Vue in the frontend and Django in the backend, but they both use double curly braces {{ }} as their template tags. Is there an easy way to change one of the two to use some other custom templating tag?

Thanks in advance.

like image 617
Safwan Samsudeen Avatar asked Jan 24 '23 17:01

Safwan Samsudeen


1 Answers

Vue has a parameter called delimiters which set the placeholder's delimiters. For example this way you'll set them to double square brackets:

new Vue({
    delimiters: ['[[', ']]'],
    el: "#myapp",
    //...
})


<div>
   {{ djangoPlaceholder }}
   [[ vuePlaceholderValue ]]
</div>
like image 112
yedpodtrzitko Avatar answered Jan 30 '23 12:01

yedpodtrzitko