Skip to content

Instantly share code, notes, and snippets.

@heroicyang
Created June 19, 2013 04:00
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 heroicyang/5811599 to your computer and use it in GitHub Desktop.
Save heroicyang/5811599 to your computer and use it in GitHub Desktop.
Handlebars调试技巧:增加如下helper之后,在模板文件里使用{{debug}}或是{{debug someValue}}即可
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
console.log("====================");
console.log(this);
if (optionalValue) {
console.log("Value");
console.log("====================");
console.log(optionalValue);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment