Skip to content

Commit a7b17dc

Browse files
add new file
1 parent 1997b59 commit a7b17dc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

handlebars-jquery.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
(function ($) {
2+
var compiled = {};
3+
4+
$.fn.template = function (data) {
5+
var template = $.trim($(this).first().html());
6+
if (compiled[template] == undefined) {
7+
compiled[template] = Handlebars.compile(template);
8+
}
9+
10+
return $(compiled[template](data));
11+
};
12+
})(jQuery);

0 commit comments

Comments
 (0)