javascript - 是否可以在 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
谢谢
解决方案
使用{% raw %}
.
{% raw %}
some nunjucks templating
{% endraw %}
并且它不会在外部模板上呈现。
推荐阅读
- django - 在 Django 中查找特定范围内的重叠日期
- c++11 - C++17 中的静态专用模板成员 - 为什么 GCC 和 MSVC 之间存在差异?
- angular - Angular 客户端 UI 是否完全在浏览器中运行
- bash - 如何删除点后的所有符号
- windows - 无法处理参数“Principal”的参数转换。无法将值“”转换为类型“Microsoft.Management.Infrastructure.CimInstance”
- c# - 并行循环,遍历大型 XML 文件导致内存不足
- c - strcat 将垃圾添加到字符串中
- javascript - Javascript on click focus latest element with multiple customelements
- c# - 使用 JSON 序列化 PictureBox
- mongodb - 如何使用特定日期通过到期删除记录?