API
render(view, data)
| 1 | const html = await template.render('info/bla', { title: 'Bla' }); |
view ist flexibel:
- absoluter Pfad (mit oder ohne
.tpl.html)
- relativer Template-Pfad (wird unter
src/templates/ gesucht)
- Pfad inkl.
src/templates/ (relativ zum Projekt-Root)
Wenn view nicht auf eine Datei aufgeloest werden kann, wird der String als Inline-Template gerendert.
renderHtml(html, data)
| 1 | const html = await template.renderHtml('<h1>{{ title }}</h1>', { title: 'Hi' }); |
Events
| Event |
Payload |
Wann |
template:init |
{ root, paths } |
Discovery beginnt |
template:discovered |
{ name, file, path } |
Einzelnes Template gefunden |
template:ready |
{ count, templates } |
Alle Templates discovert |
template:render:before |
{ view, data, traceId, dataKeys } |
Rendering beginnt |
template:render:after |
{ view, html, duration, traceId, dataKeys } |
Rendering abgeschlossen |
template:loaded |
{ name, path } |
Template-Datei geladen |
template:methods:discovered |
{ count, sources } |
Method Discovery abgeschlossen |
template:method:registered |
{ name, source } |
Einzelne Method registriert |