Skip to content

Commit

Permalink
Fix being unable to load the nanomodal module.
Browse files Browse the repository at this point in the history
  • Loading branch information
kylepaulsen committed Aug 4, 2014
1 parent 13e8422 commit 15cf3d8
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 20 deletions.
13 changes: 12 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ module.exports = function(grunt) {
}
}
},
concat: {
options: {
banner: "var nanoModal;\n",
footer: grunt.file.read("buildFooter.js")
},
dist: {
src: ["<%= pkg.name %>.js"],
dest: "<%= pkg.name %>.js"
}
},
uglify: {
options: {
mangle: true
Expand All @@ -34,12 +44,13 @@ module.exports = function(grunt) {
}
});

grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-browserify");
grunt.loadNpmTasks("grunt-contrib-qunit");

grunt.registerTask("test", ["qunit"]);
grunt.registerTask("dev", ["cssmin", "browserify"]);
grunt.registerTask("dev", ["cssmin", "browserify", "concat"]);
grunt.registerTask("default", ["dev", "uglify", "test"]);
};
12 changes: 12 additions & 0 deletions buildFooter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

if (typeof window !== "undefined") {
if (typeof window.define === "function" && window.define.amd) {
window.define(function() {
return nanoModal;
});
}
window.nanoModal = nanoModal;
}
if (typeof module !== "undefined") {
module.exports = nanoModal;
}
9 changes: 6 additions & 3 deletions nanomodal.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var nanoModal;
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var ModalEvent = require("./ModalEvent");

Expand Down Expand Up @@ -356,7 +357,7 @@ module.exports = ModalEvent;
},{}],4:[function(require,module,exports){
var ModalEvent = require("./ModalEvent");

var nanoModal = (function() {
var nanoModalAPI = (function() {



Expand Down Expand Up @@ -433,6 +434,10 @@ var nanoModal = (function() {
return api;
})();

// expose api to var outside browserify so that we can export a module correctly.
nanoModal = nanoModalAPI;

},{"./El":1,"./Modal":2,"./ModalEvent":3}]},{},[1,2,3,4]);
if (typeof window !== "undefined") {
if (typeof window.define === "function" && window.define.amd) {
window.define(function() {
Expand All @@ -444,5 +449,3 @@ if (typeof window !== "undefined") {
if (typeof module !== "undefined") {
module.exports = nanoModal;
}

},{"./El":1,"./Modal":2,"./ModalEvent":3}]},{},[1,2,3,4]);
2 changes: 1 addition & 1 deletion nanomodal.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nanomodal",
"version": "5.0.1",
"version": "5.0.3",
"description": "A small, self-contained JavaScript modal library with some extra features",
"homepage": "https://github.com/kylepaulsen/NanoModal",
"author": {
Expand All @@ -23,13 +23,14 @@
"url": "https://github.com/kylepaulsen/NanoModal/issues"
},
"license": "MIT",
"main": "nanomodal.js",
"main": "nanomodal.min.js",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-qunit": "^0.5.2",
"brfs": "^1.1.2",
"grunt-browserify": "^2.1.3",
"grunt-contrib-cssmin": "^0.10.0",
"grunt-contrib-uglify": "^0.5.0"
"grunt-contrib-uglify": "^0.5.0",
"grunt-contrib-concat": "^0.5.0"
}
}
15 changes: 3 additions & 12 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var ModalEvent = require("./ModalEvent");

var nanoModal = (function() {
var nanoModalAPI = (function() {

var fs = require("fs");

Expand Down Expand Up @@ -77,14 +77,5 @@ var nanoModal = (function() {
return api;
})();

if (typeof window !== "undefined") {
if (typeof window.define === "function" && window.define.amd) {
window.define(function() {
return nanoModal;
});
}
window.nanoModal = nanoModal;
}
if (typeof module !== "undefined") {
module.exports = nanoModal;
}
// expose api to var outside browserify so that we can export a module correctly.
nanoModal = nanoModalAPI;

0 comments on commit 15cf3d8

Please sign in to comment.