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

How to use Mustache in Twig templates? They both have the same tag delimites #441

Closed
wzup opened this issue Apr 8, 2015 · 2 comments
Closed

Comments

@wzup
Copy link

wzup commented Apr 8, 2015

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

@dasilvacontin
Copy link
Collaborator

You can change the delimiters programatically. https://github.com/janl/mustache.js/blob/master/mustache.js#L552

@bobthecow
Copy link

You can also use Twig's verbatim tag to keep it from hitting Mustache's change delimiter tag:

{% verbatim %}
{{=<% %>=}}
{% endverbatim %}

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

3 participants