Encapsulate groups of entities, use templating engines, and do string interpolations in A-Frame
npm install aframe-template-componentA template component for A-Frame VR.
Features:
- Simple ES6-style templating
- Defining context variables via data attributes or from components
- Agnostic template engine support, choose from popular templating engines
- Rendering templates before, at the beginning, at the end, or after entities
- Loading templates defined within script tags
- Loading external templates
- Lazy-loading template engines
Supports:
- Vanilla HTML (with basic ES6 templating)
- Handlebars.js
- Pug (formerly Jade)
- mustache.js
- Nunjucks
``html
`
#### template
| Property | Description |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| src | Selector to a
#### NPM Installation
Install via NPM:
`bash
npm install aframe-template-component
`Then register and use.
`js
require('aframe');
require('aframe-template-component');
``Note if using this within React, make sure the template is defined outside of
React's root. React will treat the template as actual DOM rather than a string.