diff --git a/.gitignore b/.gitignore index 1c131aa..fffec08 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.esproj .DS_Store -.codekit-cache \ No newline at end of file +.codekit-cache +node_modules \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..c2a29ce --- /dev/null +++ b/package.json @@ -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 " + ], + "license": "WTFPL", + "bugs": { + "url": "https://github.com/idiot/unslider/issues" + }, + "homepage": "https://github.com/idiot/unslider#readme", + "dependencies": { + "jquery": "^2.1.4" + } +} diff --git a/src/js/unslider.js b/src/js/unslider.js index 157a069..22d2774 100755 --- a/src/js/unslider.js +++ b/src/js/unslider.js @@ -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'); @@ -613,4 +619,4 @@ }); }; -})(window.jQuery); \ No newline at end of file +})); \ No newline at end of file