Skip to content

Instantly share code, notes, and snippets.

@ramnathv
Forked from jaketrent/fiddle.html
Created May 19, 2013 22:52
Show Gist options
  • Save ramnathv/5609376 to your computer and use it in GitHub Desktop.
Save ramnathv/5609376 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>HandlebarsJs Demo</title>
<script type="text/javascript"
src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<link href='http://fonts.googleapis.com/css?family=Righteous' rel='stylesheet' type='text/css'>
<style>
body {
font-family: 'Righteous', cursive;
background: #FFD948;
}
.container {
margin: 0 auto;
margin-top: 100px;
width: 400px;
max-width: 100%;
font-size: 2em;
}
</style>
</head>
<body>
<script id="tmpl" type="text/x-handlebars-template">
<h1>Hello, {{ name }}.</h1>
<h2>Handlebars loves you.</h2>
</script>
<div class="container">
<div id="content"></div>
</div>
<script>
var tmpl = Handlebars.compile(document.getElementById('tmpl').innerHTML);
document.getElementById('content').innerHTML = tmpl({ name: 'Jake' });
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment