Skip to content

Instantly share code, notes, and snippets.

@agibralter
Forked from documentcloud/jammit-mustache.js
Created April 19, 2010 22:22
Show Gist options
  • Save agibralter/371734 to your computer and use it in GitHub Desktop.
Save agibralter/371734 to your computer and use it in GitHub Desktop.
Mustache.js templating function for Jammit.
// Add a Mustache.js templating function to your JavaScript:
Mustache.template = function(templateString) {
return function () {
if (arguments.length < 1) {
// With no arguments, return the raw template -- useful for rendering
// partials.
return templateString;
} else {
return Mustache.to_html(templateString, arguments[0], arguments[1]);
}
};
};
// And then, in assets.yml, you can set "template_function" to "Mustache.template".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment