I’m a bit confused to what it actually means to have precompiled Handlebar.js templates. Since handlebar requires data i.e <tag>{{title}}</tag> which I am sending through Express.js what would it mean to even have precompiled templates?
I’m a bit confused to what it actually means to have precompiled Handlebar.js templates
Share
Compiling in this context means converting your template string into a Javascript function. For your example the resulting function body would be something like
return '<tag>' + title + '</tag>'. This is faster than using regular expressions to process the template. It also means the compiled templates can be used in the browser without the whole Handlebars library.