Add UMD wrapper - #209
Open
flintinatux wants to merge 1 commit into
Open
Conversation
|
I would very much like this—thanks @flintinatux for doing this! +1 |
|
👍 This would be awesome! |
Contributor
There was a problem hiding this comment.
please keep the style of the IIFE. The semicolon actually makes sense: #192.
|
Just curious, is there not interest in adding this backwards compatible feature? It looks like there's a fork for this on npm already. It'd be great to have the official library up there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our team has gotten excellent mileage out of this little library, but have recently switched to browserify as a build tool. This little PR adds a UMD wrapper around the FitVids factory, such that it can be consumed in three different ways, all of which still allow your choice between jQuery or Zepto.
For
nodeor CommonJS environments (such as browserify), it exports the factory itself, so that the choice of DOM library can be wired up manually:For AMD environments (like require.js), you can just
requireFitVids and then go about your business, since it will wrap itself around whichever DOM library you shimmed in as'jquery':For those who like to live in the global namespace, that's cool too. The UMD wrapper will recognize that and look for
window.jQueryorwindow.Zeptoas before.I ran the
test.htmlfile, and everything performs as it originally did. This PR should also get you very close to publishing on npm (short of actually runningnpm publish .). That would be super dreamy! 😄