Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #174 from misoproject/166.requirejs
Browse files Browse the repository at this point in the history
Added require.js and amd support.
  • Loading branch information
iros committed Sep 25, 2012
2 parents de7a321 + f5defe2 commit 735cfce
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
20 changes: 18 additions & 2 deletions grunt.js
Expand Up @@ -49,6 +49,14 @@ module.exports = function(grunt) {
]
},

fullnodepsrequire: {
dest : "dist/miso.ds.<%= pkg.version %>.m.js",
src : [
"dist/miso.ds.<%= pkg.version %>.js",
"src/require.js"
]
},

fulldeps: {
dest : "dist/miso.ds.deps.<%= pkg.version %>.js",
src : [
Expand Down Expand Up @@ -117,7 +125,15 @@ module.exports = function(grunt) {
"dist/miso.ds.<%= pkg.version %>.js"
]
},


monnodepsrequire : {
dest : "dist/miso.ds.min.<%= pkg.version %>.m.js",
src : [
"<banner>",
"dist/miso.ds.<%= pkg.version %>.m.js"
]
},

mindeps : {
dest : "dist/miso.ds.deps.min.<%= pkg.version %>.js",
src : [
Expand Down Expand Up @@ -205,7 +221,7 @@ module.exports = function(grunt) {
browser : true,
bitwise : true,
loopfunc : true,
predef : [ "_", "moment", "log", "template" ]
predef : [ "_", "moment", "log", "template", "exports", "define" ]
},
globals : {
QUnit : true,
Expand Down
21 changes: 21 additions & 0 deletions src/require.js
@@ -0,0 +1,21 @@
(function(global) {

var Miso = global.Miso || {};
delete window.Miso;

// CommonJS module is defined
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
// Export module
module.exports = Miso;
}
exports.miso = Miso;

} else if (typeof define === 'function' && define.amd) {
// Register as a named module with AMD.
define('miso', [], function() {
return Miso;
});
}

}(this));

0 comments on commit 735cfce

Please sign in to comment.