Last active
December 16, 2015 07:09
-
-
Save ridgehkr/5396894 to your computer and use it in GitHub Desktop.
Using yepnope in CoffeeScript to test for Zepto compatibility with a fallback to jQuery
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
yepnope [ | |
{ | |
# if IE, we need jQuery. Otherwise, Zepto will do just fine | |
test: '__proto__' of {} | |
yep: '//cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js' | |
nope: '//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js' | |
complete: -> | |
# use local jQuery fallback if neither Zepto nor jQuery loaded | |
!Zepto? and !window.jQuery? and yepnope('js/libs/jquery-1.9.1.min.js') | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment