Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Handlebars client-side templates
<!DOCTYPE html>
<script src=""></script>
<script type="text/handlebars">
<p>Hello, {{name}}!</p>
'use strict';
var model = {
id: "one",
name: "Josh"
id: "two",
name: "Nick"
var scripts ="script"));
var templates = scripts.filter(script => script.type == "text/handlebars");
templates.forEach(template => {
var output = Handlebars.compile(template.innerHTML);
template.outerHTML = output(model);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.