Skip to content

Instantly share code, notes, and snippets.

@kossnocorp
Created December 31, 2011 07:02
Show Gist options
  • Save kossnocorp/1543189 to your computer and use it in GitHub Desktop.
Save kossnocorp/1543189 to your computer and use it in GitHub Desktop.
- unless Rails.env.development?
/ Require jQuery
= javascript_include_tag 'http://yandex.st/jquery/1.7.1/jquery.min.js'
/ Require Google's jQuery if Yandex is down
:javascript
window.jQuery || document.write('<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">\x3C/script>')
/ Require local jQuery if Google is down / is development env
:javascript
window.jQuery || document.write('<script src="#{asset_path('jquery.js')}">\x3C/script>')
@arestov
Copy link

arestov commented Dec 31, 2011

@yaroslav
Copy link

Nice, но Яндекс не нужен (c) LOR. Смысл-то в том, что будет очень высока вероятность кеш хита, то есть что человек уже был на сайте с внешним jQuery, то есть на googleapis в большинстве случаев. Потом, googleapis пока не лежал, чего не скажешь.

@julik
Copy link

julik commented Jan 4, 2012

Между прочим googleapis недавно как раз немножечко то ли лежал то ли глючил. Но в целом я согласен с предыдущим оратором.

@Grawl
Copy link

Grawl commented Feb 1, 2012

Вот не знаю как у вас, а у нас в Приморье с интернетами какая-то фигня творится, что периодически Google не отзывается. Поэтому jQ подключаю всегда с того же домена, на котором сайт.

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