Skip to content

Commit

Permalink
CommonJS compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
dorayx committed Feb 2, 2016
1 parent 9d67084 commit 575bd7a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.esproj
.DS_Store
.codekit-cache
.codekit-cache
node_modules
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "unslider",
"version": "2.0.3",
"description": "The simplest little slider.",
"styles": [
"dist/css/unslider.css",
"dist/css/unslider-dots.css"
],
"main": "src/js/unslider.js",
"repository": {
"type": "git",
"url": "git+https://github.com/idiot/unslider.git"
},
"keywords": [
"slider",
"jquery",
"unslider",
"carousel"
],
"author": [
"Visual Idiot <[email protected]>"
],
"license": "WTFPL",
"bugs": {
"url": "https://github.com/idiot/unslider/issues"
},
"homepage": "https://github.com/idiot/unslider#readme",
"dependencies": {
"jquery": "^2.1.4"
}
}
12 changes: 9 additions & 3 deletions src/js/unslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
* version 2.0
* by @idiot and friends
*/

(function($) {

(function(factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
factory(require('jquery'));
} else {
factory(window.jQuery);
}
}(function($) {
// Don't throw any errors when jQuery
if(!$) {
return console.warn('Unslider needs jQuery');
Expand Down Expand Up @@ -613,4 +619,4 @@
});
};

})(window.jQuery);
}));

0 comments on commit 575bd7a

Please sign in to comment.