Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UMD wrapper #209

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bower_components
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope. Should be in a global gitignore, not project-specific.

18 changes: 15 additions & 3 deletions jquery.fitvids.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,20 @@
*
*/

;(function( $ ){
!function(factory) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep the style of the IIFE. The semicolon actually makes sense: #192.

if ("object" == typeof exports && "undefined" != typeof module) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single quotes instead of doubles.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also use strict equals, to calm down jshint and for code quality.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these comment apply the the code under this as well.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line takes a while to parse for humans. There's no deal with trying to make code as small as possible in non-minified source so let's format it.

// Works with either jQuery or Zepto
factory(n.jQuery || n.Zepto);
}
}(function( $ ){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to keep the code style consistent (spacing I mean)


'use strict';

Expand Down Expand Up @@ -79,5 +92,4 @@
});
});
};
// Works with either jQuery or Zepto
})( window.jQuery || window.Zepto );
});
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "fitvids",
"version": "1.1.0",
"description": "FitVids makes video embeds responsive",
"keywords": [
"FitVids",
"Responsive",
"RWD",
"YouTube",
"Vimeo"
],
"license": "WTFPL",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davatron5000 is this correct?

"main": "jquery.fitvids.js",
"ignore": [
"**/.*",
"node_modules",
"components",
"bower_components",
"test",
"tests"
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use files instead of ignoring things.

"dependencies": {},
"devDependencies": {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these two lines. no deal with empty stuff. if npm needs them, it will include it again.

}