首页 > 解决方案 > 是否可以在 A-Frame 中的另一个 nunjuck 模板文字内创建一个 nunjuck 模板文字?

问题描述

我想在我的“建筑”模板文字中有一个“玻璃”模板文字。

<script id="building" type="text/x-nunjucks-template">
  {% for x in range(0, 5) %}
  <a-entity template="src: building.template; type:         handlebars" position="{{ x * 5 }} 0 0">
  </a-entity>
  {% endfor %}
</script>

<script id="glass" type="text/x-nunjucks-template">
  {% for x in range(0, 5) %}
  <a-entity template="src: glass.template; type: handlebars" position="{{ x }} 2 2">
  </a-entity>
  {% endfor %}
</script>

我知道它们需要在 .HTML 文件中运行 - 我只是想知道是否有解决方法,所以我可以拥有以下内容:

index.html --> building.template --> glass.template

谢谢

标签: javascriptaframenunjucks

解决方案


使用{% raw %}.

{% raw %}
  some nunjucks templating
{% endraw %}

并且它不会在外部模板上呈现。


推荐阅读