Skip to content

Instantly share code, notes, and snippets.

@davidbrooks
Created July 31, 2014 17:59
Show Gist options
  • Save davidbrooks/429870a36ffd6063343e to your computer and use it in GitHub Desktop.
Save davidbrooks/429870a36ffd6063343e to your computer and use it in GitHub Desktop.
Finds everything with class="replace" and throws it through handlebars against a loaded config file.
function replace() {
var source, template, html;
$.getJSON( "/config.json", function( data ) {
$('.replace').each(function () {
source = $(this).parent().html();
template = Handlebars.compile(source);
html = template(data);
$(this).parent().html(html);
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment