Skip to content

Instantly share code, notes, and snippets.

@serverwentdown
Created June 5, 2015 07:11
Show Gist options
  • Save serverwentdown/89694ee513578e45ab5c to your computer and use it in GitHub Desktop.
Save serverwentdown/89694ee513578e45ab5c to your computer and use it in GitHub Desktop.
Basic client-side handlebars templating.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="text/x-handlebars-template">
<ul>
{{#each items}}
<li>{{title}}</li>
{{/each}}
</ul>
</script>
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v3.0.3.js"></script>
<script src="https://gist.githubusercontent.com/ambrosechua/9e4455100c43a8a2cb1c/raw/754c759e02a3980c265440b18b82c1f5529b6115/handlebars-autorenderer.js"></script>
<script>
var a = new AutoRenderer();
a.update({
items: [{
title: "NOPE"
}, {
title: "HACK"
}]
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment