Quickstart
import { QTemplate, TemplatesStore } from '@quik/templates';
await TemplatesStore.load('core', './templates');
class WelcomeTemplate extends QTemplate<{ name: string }> {
constructor(name: string) {
super('core.welcome', { name });
}
}
const output = new WelcomeTemplate('Quik').render();
Notes
- Templates are addressed by lowercase
module.filenamekeys (e.g.core.welcome,core.email.welcomefor nested files) — themoduleargument toTemplatesStore.load(module, ...folders)becomes the key prefix. - There is no standalone
render()export — always render through aQTemplatesubclass's.render()method. TemplatesStore.load()reads templates into memory once; callTemplatesStore.reload()(orclear()+load()) to pick up file changes, or settemplates.disableCacheto re-read from disk on every access.