Support AMD and CommonJS out of the box

This commit is contained in:
Spike Brehm
2013-05-27 11:22:25 -07:00
parent 5f349913aa
commit efca3c8ef5
4 changed files with 45 additions and 12 deletions
+2 -3
View File
@@ -1,3 +1,2 @@
var Handlebars = {};
(function(Handlebars, undefined) {
(function(undefined) {
var Handlebars = {};
+13 -1
View File
@@ -1 +1,13 @@
})(Handlebars);
if (typeof module === 'object' && module.exports) {
// CommonJS
module.exports = Handlebars;
} else if (typeof define === "function" && define.amd) {
// AMD modules
define(function() { return Handlebars; });
} else {
// other, i.e. browser
this.Handlebars = Handlebars;
}
}).call(this);