Skip to content

Instantly share code, notes, and snippets.

@rissem
Created August 17, 2012 06:00
Show Gist options
  • Save rissem/3376325 to your computer and use it in GitHub Desktop.
Save rissem/3376325 to your computer and use it in GitHub Desktop.
Hogan Sandbox
<script src="http://twitter.github.com/hogan.js/builds/2.0.0/hogan-2.0.0.js"></script>
<script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<form>
<h3>Javascript</h3>
<textarea id="javascript" rows="8" cols="80">var x = {name: "sample text"}</textarea>
<h3>Mustache</h3>
<textarea id="mustache" rows="8" cols="80">{{name}}</textarea>
</form>
<h3>Output</h3>
<div id="output"></div>
<script>
window.setInterval(function(){
eval($("#javascript").val());
var templateString = $("#mustache").val();
var template = Hogan.compile(templateString);
$("#output").html(template.render(x))
}, 1500)
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment