Precompile Underscore templates without underscore.js dependency
I am using grunt-contrib-jst to precompile my templates and it's all working great. However, I am using this to build a plugin and I want to keep the filesize as small as possible.
I don't use underscore.js in my code, but the precompiled templates seem to have it as a dependency. Here is a sample:
template = function(obj) {
obj || (obj = {});
var __t, __p = '', __e = _.escape;
with (obj) {
__p += '<div>n</div>';
}
return __p
};
As you can see, the snippet __e = _.escape
requires underscore.js, but the template doesn't use __e
at all.
Is there any way I can force grunt-contrib-jst to compile templates in a way so they don't require underscore.js?
链接地址: http://www.djcxy.com/p/72080.html