Skip to content

Instantly share code, notes, and snippets.

@doingweb
Created August 13, 2014 17:51
Show Gist options
  • Save doingweb/0a5d15318a29df75ed9d to your computer and use it in GitHub Desktop.
Save doingweb/0a5d15318a29df75ed9d to your computer and use it in GitHub Desktop.
Assemble (Handlebars) helper for printing JSON
module.exports.register = function (Handlebars, options, params) {
Handlebars.registerHelper('json', function(context) {
return JSON.stringify(context, null, 2);
});
};
@doingweb
Copy link
Author

I use it for quick debugging when a template isn't coming out with what I expect:

{{{json this}}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment