Created
August 30, 2016 11:08
-
-
Save halfzebra/307f29a52999a4cd85b81b7c8e476f48 to your computer and use it in GitHub Desktop.
Print HTML comment with template name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Handlebars.templates = new Proxy(Handlebars.templates, { | |
get: function (target, property) { | |
var TEMPLATE_KEY = '<!-- TEMPLATE: Teamplates/' + property + '.handlebars -->\n' | |
var method = target[ property ]; | |
if (typeof target[ property ] === 'function') { | |
return new Proxy(method, { | |
apply: function (target, thisArg, argumentsList) { | |
return TEMPLATE_KEY + target.apply(thisArg, argumentsList) + TEMPLATE_KEY; | |
} | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment