From 19507d24074e0839d50d96524494b484c780b6cb Mon Sep 17 00:00:00 2001 From: Scott McCormack Date: Fri, 6 Mar 2015 14:44:23 -0500 Subject: [PATCH] Add UMD wrapper --- .gitignore | 1 + jquery.fitvids.js | 18 +++++++++++++++--- package.json | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b37e43d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bower_components diff --git a/jquery.fitvids.js b/jquery.fitvids.js index f8d6b97..693952e 100644 --- a/jquery.fitvids.js +++ b/jquery.fitvids.js @@ -9,7 +9,20 @@ * */ -;(function( $ ){ +!function(factory) { + if ("object" == typeof exports && "undefined" != typeof module) { + module.exports = factory; + } + else if ("function" == typeof define && define.amd) { + define(['jquery'], factory); + } + else { + var n; + "undefined" != typeof window ? n = window : "undefined" != typeof global ? n = global : "undefined" != typeof self && (n = self); + // Works with either jQuery or Zepto + factory(n.jQuery || n.Zepto); + } +}(function( $ ){ 'use strict'; @@ -79,5 +92,4 @@ }); }); }; -// Works with either jQuery or Zepto -})( window.jQuery || window.Zepto ); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..2cc3165 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "fitvids", + "version": "1.1.0", + "description": "FitVids makes video embeds responsive", + "keywords": [ + "FitVids", + "Responsive", + "RWD", + "YouTube", + "Vimeo" + ], + "license": "WTFPL", + "main": "jquery.fitvids.js", + "ignore": [ + "**/.*", + "node_modules", + "components", + "bower_components", + "test", + "tests" + ], + "dependencies": {}, + "devDependencies": {} +}