summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/browser-suffix.js
diff options
context:
space:
mode:
authorSpike Brehm <ocelot@gmail.com>2013-05-27 11:22:25 -0700
committerSpike Brehm <ocelot@gmail.com>2013-05-27 11:22:25 -0700
commitefca3c8ef5665fe3cf2802f866db0c73755824e0 (patch)
treebf33248d5d4a230421545e1e5002e2ad25f9b315 /lib/handlebars/browser-suffix.js
parent5f349913aa1e3efebcd0a6835d33161c7c81d7a9 (diff)
downloadhandlebars.js-efca3c8ef5665fe3cf2802f866db0c73755824e0.zip
handlebars.js-efca3c8ef5665fe3cf2802f866db0c73755824e0.tar.gz
handlebars.js-efca3c8ef5665fe3cf2802f866db0c73755824e0.tar.bz2
Support AMD and CommonJS out of the box
Diffstat (limited to 'lib/handlebars/browser-suffix.js')
-rw-r--r--lib/handlebars/browser-suffix.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/handlebars/browser-suffix.js b/lib/handlebars/browser-suffix.js
index 36c52c0..d357c72 100644
--- a/lib/handlebars/browser-suffix.js
+++ b/lib/handlebars/browser-suffix.js
@@ -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);