rome
rome

Reputation: 579

Is it possible to create a nunjuck template literal inside another nunjuck template literal in A-Frame?

I want to have a 'glass' template literal inside my 'building' template literal.

<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>

I understand that they need to be run inside .HTML files - I just wondered if there was a work around so I could have the following:

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

Thank you

Upvotes: 2

Views: 565

Answers (1)

ngokevin
ngokevin

Reputation: 13233

Use {% raw %}.

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

And it won't be rendered on the outer template.

Upvotes: 4

Related Questions