Skip to content

Instantly share code, notes, and snippets.

@sevennineteen
Created March 9, 2013 15:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sevennineteen/5124602 to your computer and use it in GitHub Desktop.
Save sevennineteen/5124602 to your computer and use it in GitHub Desktop.
Simple Handlebars helper to dump current context to screen for debugging
define(['handlebars'], function (Handlebars) {
var templateHelpers = {
// Register all defined template helpers
load: function () {
// Render JSON representation of current context,
// e.g., {{{debug this}}}
Handlebars.registerHelper('debug', function (context) {
return new Handlebars.SafeString(
'<div class="debug">' + JSON.stringify(context) + '</div>'
);
});
}
};
return templateHelpers;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment