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
+15 -4
View File
@@ -23,9 +23,8 @@ THE SOFTWARE.
*/
// lib/handlebars/browser-prefix.js
var Handlebars = {};
(function(Handlebars, undefined) {
(function(undefined) {
var Handlebars = {};
;
// lib/handlebars/base.js
@@ -2235,5 +2234,17 @@ Handlebars.VM = {
Handlebars.template = Handlebars.VM.template;
;
// lib/handlebars/browser-suffix.js
})(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);
;
+15 -4
View File
@@ -23,9 +23,8 @@ THE SOFTWARE.
*/
// lib/handlebars/browser-prefix.js
var Handlebars = {};
(function(Handlebars, undefined) {
(function(undefined) {
var Handlebars = {};
;
// lib/handlebars/base.js
@@ -341,5 +340,17 @@ Handlebars.VM = {
Handlebars.template = Handlebars.VM.template;
;
// lib/handlebars/browser-suffix.js
})(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);
;
+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);