Created
August 17, 2012 06:00
-
-
Save rissem/3376325 to your computer and use it in GitHub Desktop.
Hogan Sandbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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