Browse files

always export to globals, to prevent breaking existing implementations

  • Loading branch information...
1 parent 215b953 commit 9400fba50c035a3248a6c63751758ae93fe2364c @bcherny bcherny committed Nov 4, 2013
Showing with 20 additions and 5 deletions.
  1. +3 −2 Gruntfile.js
  2. +3 −3 gmaps.js
  3. +14 −0 umd.hbs
View
5 Gruntfile.js
@@ -64,10 +64,11 @@ module.exports = function(grunt) {
umd : {
all : {
- src : 'grunt.js',
+ src : 'gmaps.js',
objectToExport : 'GMaps',
amdModuleId : 'GMaps',
- globalAlias : 'GMaps'
+ globalAlias : 'GMaps',
+ template : 'umd.hbs'
}
}
View
6 gmaps.js
@@ -5,9 +5,9 @@
else if(typeof define === 'function' && define.amd) {
define('GMaps', [], factory);
}
- else {
- root.GMaps = factory();
- }
+
+ root.GMaps = factory();
+
}(this, function() {
/*!
* GMaps.js v0.4.7
View
14 umd.hbs
@@ -0,0 +1,14 @@
+(function(root, factory) {
+ if(typeof exports === 'object') {
+ module.exports = factory({{{cjsDependencies}}});
+ }
+ else if(typeof define === 'function' && define.amd) {
+ define({{#if amdModuleId}}'{{amdModuleId}}', {{/if}}[{{{amdDependencies}}}], factory);
+ }
+
+ root.{{globalAlias}} = factory({{{globalDependencies}}});
+
+}(this, function({{dependencies}}) {
+{{{code}}}
+ return {{objectToExport}};
+}));

0 comments on commit 9400fba

Please sign in to comment.