Skip to content

Instantly share code, notes, and snippets.

@shinnn
Created June 10, 2013 10:29
Show Gist options
  • Select an option

  • Save shinnn/5747814 to your computer and use it in GitHub Desktop.

Select an option

Save shinnn/5747814 to your computer and use it in GitHub Desktop.

Revisions

  1. shinnn created this gist Jun 10, 2013.
    18 changes: 18 additions & 0 deletions loadjquery.jade
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    mixin loadJQuery(version)
    script(src='https://ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js')

    - var jQueryFallbacks = [];
    - jQueryFallbacks[0] = 'http://code.jquery.com/jquery-' + version + '.min.js';
    - jQueryFallbacks[1] = 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-' + version + '.min.js';
    - jQueryFallbacks[2] = 'js/jquery' + (version.charAt(0) === '1'? '1': '') +'.js';

    each url in jQueryFallbacks
    script.
    window.jQuery || document.write('<script src=#{url}><\/script>');

    //if lt IE 9
    mixin loadJQuery('1.10.1')
    //if gte IE 9
    <!-->
    mixin loadJQuery('2.0.2')
    <!--