Skip to content

Instantly share code, notes, and snippets.

@ridgehkr
Last active December 16, 2015 07:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ridgehkr/5396894 to your computer and use it in GitHub Desktop.
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
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