JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.min.js"></script>
<div id='template'>
{{#if activated}}
{{#if appkeyProvided}}
<script type="text/javascript">
window["adrum-app-key"] = "{{appkey}}";
</script>
{{/if}}
{{/if}}
</div>
JavaScript
var templateTag = $('#template');
var template = templateTag.html();
var templateCompile = Handlebars.compile(template);
var integrationScriptTag = templateCompile({activated: true, appkeyProvided: true, appkey: "dummy"});
$(document).ready(function() {
templateTag.remove();
$('head').append(integrationScriptTag);
// Integration tag is not inserted into head
alert($('head').html());
});