-
Notifications
You must be signed in to change notification settings - Fork 3
Cookbook: Using Templates
David Souther edited this page Mar 6, 2015
·
4 revisions
Regardless of markup type (e.x.: Jade or HTML), templates are persisted in Rupert's templates.js file. Rupert intelligently stores templates as based off of the template's relative 'feature' directory name via a <dir>/<component name>-template.<ext>
format.
main/template.jade
main/content/content-template.html
main/dashboard/panel-template.jade
...the templates are now respectively accessible via:
window.Templates['main']
window.Templates['main/content']
window.Templates['main/dashboard/panel']
- If you're using Rupert's Angular config, please see this cookbook entry regarding templates.
- Templates must have a known extension in the Template Renderer (Default HTML & Jade, must transpile to HTML, new renderers may be added).
- Templates may have an arbitrary prefix, separated with a - eg -template..
- The generated fragment name is The path within the client source folder, as determined by AssetWatcher::pathpart
- Except the suffix
template.<extension>
and either the preceding-
or/
are dropped. - If the template file prefix matches the parent directory name, the prefix gets dropped.