我在我的项目中使用 Twig。 它使用这些标签: {{ name }}
我也想在我的项目中包含 Mustache。 但是 Mustache 也使用相同的标签{{ name }}
,因此存在冲突并且没有任何效果。
Mustache 在他们的文档中提供的解决方案当然不起作用。 因为我必须在我的 Twig 模板中输入 Twig 分隔符{{
才能更改 Mustache 分隔符。
* {{ default_tags }}
{{=<% %>=}}
* <% erb_style_tags %>
<%={{ }}=%>
* {{ default_tags_again }}
如何通过它? 有没有其他方法可以在设置中的某个地方更改 Mustache 分隔符?
Stackoverflow 上的问题http://stackoverflow.com/questions/29509827/how-to-use-mustache-in-twig-templates-they-both-have-the-same-tag-delimites
您还可以使用 Twig 的verbatim
标签来防止它碰到 Mustache 的更改分隔符标签:
{% verbatim %}
{{=<% %>=}}
{% endverbatim %}
最有用的评论
您还可以使用 Twig 的
verbatim
标签来防止它碰到 Mustache 的更改分隔符标签: