Handlebars template assembly

Kirk Strobeck
1 min readOct 15, 2015

--

Sometimes you need to assemble the templates before actually rendering the data. Both actions shouldn’t be broad sweeping, but specific. For example, sometimes the data presents an either/or render that the HTML needs in order to assemble the partials and code blocks properly.

My use-case was email templating. I wanted to run the HTML thru Premailer prior to compiling with the data. The trick, undocumented Handlebars variable escaping.

If it seems confusing, don’t worry, you’re not alone; It’s a rare use-case so even the community and collaborators were stumped too.

--

--