-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
Description
For anyone trying to load precompiled templates from typescript (for sending an email for instance):
- You have to precompile with the -c option:
handlebars templates/*.handlebars -f templates/precompiled.js -c handlebars/runtime
- Load the Handlebars runtime and then the templates file:
import * as Handlebars from 'handlebars/runtime';
import './templates/precompiled'; // load templates
- Use as always:
Handlebars.templates['name-of-file-without-extension'](data)
I hope this helps you and you don't waste many hours like me.
Raul6469, githup891, Sangrene, NLKNguyen, ccravens and 7 moreRaul6469, ccravens, haworku and mrloop