I use Twig in my project. It uses these tags: {{ name }}
I want to include Mustache in my project as well. But Mustache also uses the same tags {{ name }}
, so there is a conflict and nothing works.
The solution Mustache provides in their docs of course doesn't work. Because I have to type Twig delimiter {{
in my Twig template to change Mustache delimiter.
* {{ default_tags }}
{{=<% %>=}}
* <% erb_style_tags %>
<%={{ }}=%>
* {{ default_tags_again }}
How to pass over it? Is there any other way to change Mustache delimiters once somewhere in settings?
The question on Stackoverflow http://stackoverflow.com/questions/29509827/how-to-use-mustache-in-twig-templates-they-both-have-the-same-tag-delimites
You can change the delimiters programatically. https://github.com/janl/mustache.js/blob/master/mustache.js#L552
You can also use Twig's verbatim
tag to keep it from hitting Mustache's change delimiter tag:
{% verbatim %}
{{=<% %>=}}
{% endverbatim %}
Most helpful comment
You can also use Twig's
verbatim
tag to keep it from hitting Mustache's change delimiter tag: