Skip to content

Instantly share code, notes, and snippets.

@donabrams
Created September 7, 2011 19:20
Show Gist options
  • Save donabrams/1201452 to your computer and use it in GitHub Desktop.
Save donabrams/1201452 to your computer and use it in GitHub Desktop.
Optional use of require for jquery plugins (require not required)
requireOnlyIfRequireExists = function(deps, func) { if (require) {require(deps, func);} else { func(); }};
requireOnlyIfRequireExists(["jquery.min"], function () {
/*
Insert normal jquery plugin logic here
*/
});
@donabrams
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment