Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AMD and CommonJS out of the box #537

Merged
merged 1 commit into from
May 31, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions dist/handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ THE SOFTWARE.
*/

// lib/handlebars/browser-prefix.js
var Handlebars = {};

(function(Handlebars, undefined) {
(function(undefined) {
var Handlebars = {};
;
// lib/handlebars/base.js

Expand Down Expand Up @@ -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);
;
19 changes: 15 additions & 4 deletions dist/handlebars.runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ THE SOFTWARE.
*/

// lib/handlebars/browser-prefix.js
var Handlebars = {};

(function(Handlebars, undefined) {
(function(undefined) {
var Handlebars = {};
;
// lib/handlebars/base.js

Expand Down Expand Up @@ -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);
;
5 changes: 2 additions & 3 deletions lib/handlebars/browser-prefix.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
var Handlebars = {};

(function(Handlebars, undefined) {
(function(undefined) {
var Handlebars = {};
14 changes: 13 additions & 1 deletion lib/handlebars/browser-suffix.js
Original file line number Diff line number Diff line change
@@ -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);