Created
September 7, 2011 19:20
-
-
Save donabrams/1201452 to your computer and use it in GitHub Desktop.
Optional use of require for jquery plugins (require not required)
This file contains 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
requireOnlyIfRequireExists = function(deps, func) { if (require) {require(deps, func);} else { func(); }}; | |
requireOnlyIfRequireExists(["jquery.min"], function () { | |
/* | |
Insert normal jquery plugin logic here | |
*/ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The only downside of this is not being able to use the awesomeness that is AMD (such as text loading for templates and css loading with cssx)