If you are trying to set and use a local variable within handlebars try something like this:
First, create a helper function:
var handlebars = require('handlebars');
handlebars.registerHelper("setVar", function(varName, varValue, options) {
options.data.root[varName] = varValue;
});
Next, set your variable(s).
{{setVar "greeting" "Hello World!"}}
{{#if some-condition}}
{{setVar "branding" "Value one"}}
{{else}}
{{setVar "branding" "Value 2"}}
{{/if}}
Finally, use the variable(s):
<div>
<h1>{{greeting}}</h1>
</div>
document.getElementById("BrandLogo").innerHTML = {{branding}};
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…