JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.11/handlebars.js"></script>
<h3>Normal Output</h3>
<pre id="normal-output"></pre>
<h3>Strict Output</h3>
<pre id="strict-output"></pre>
CSS
pre {
margin-left: 20px;
}
h3 {
margin-bottom: 20px;
}
pre + h3 {
margin-top: 40px;
}
JavaScript
Handlebars.registerHelper('json', context => JSON.stringify(context))
var template = `{{#each utils as |aUtility idx|}}
json aUtility
{{{json aUtility}}}
json idx
{{{json idx}}}
json this
{{{json this}}}
{{/each}}`
var compiledTemplate = {
strict: Handlebars.compile(template, { strict: true }),
normal: Handlebars.compile(template, {}),
}
var context = {
utils: [{ name: 'utilName' }],
}
document.getElementById('strict-output').innerHTML = compiledTemplate.strict(context);
document.getElementById('normal-output').innerHTML = compiledTemplate.normal(context);