README.md in jquery-rails-cdn-0.1.0 vs README.md in jquery-rails-cdn-0.2.0

- old
+ new

@@ -10,24 +10,27 @@ ## Features This gem offers the following features: -* Supports multiple CDN. (Google, Microsoft and jquery.com) -* jQuery version is automatically detected via jquery-rails. +* Supports multiple CDN. (Google, Microsoft, jquery.com, etc.) +* jQuery version is automatically detected via `jquery-rails`. * Automatically fallback to jquery-rails' bundled jQuery when: * You're on a development environment, so that you can work offline. - * The CDN is down or unavailable. + * The CDN is down or unreachable. -On top of that, if you're using asset pipeline, you may have noticed that the major chunks of the code in `application.js` is jQuery. Implications of externalizing jQuery from `application.js` are: +On top of that, if you're using asset pipeline, you may have noticed that the major chunks of the code in combined `application.js` is jQuery. Implications of externalizing jQuery from `application.js` are: -* Updating your js code won't evict the entire cache in browsers - your code changes more often than jQuery upgrades, right? -* `rake assets:precompile` takes less peak memory usage. +* Updating your JS code won't evict the entire cache in browsers. + * Cached jQuery in the client browsers will survive deployments. + * Your code changes more often than jQuery upgrades, right? +* `rake assets:precompile` will run faster and use less memory. Changelog: -* v0.1.0: Added :google_schemeless for sites that support both ssl / non-ssl +* v0.2.0: (Incompatible Change) Google CDN is now always scheme-less. Add Yandex CDN for Russian users. (Thanks to @ai) +* v0.1.0: Added `:google_schemeless` for sites that support both ssl / non-ssl * v0.0.1: Initial release ## Installation Add this line to your application's Gemfile: @@ -36,11 +39,11 @@ gem 'jquery-rails-cdn' ``` ## Usage -This gem adds two methods `jquery_include_tag` and `jquery_url` to generate a script tag to the jQuery on a CDN of your preference. +This gem adds two methods `jquery_include_tag` to generate a script tag to the jQuery on a CDN of your preference. If you're using asset pipeline with Rails 3.1+, first remove `//= require jquery` from `application.js`. Then in layout: @@ -51,14 +54,13 @@ Note that valid CDN symbols are: ```ruby :google -:google_ssl -:google_schemeless :microsoft :jquery +:yandex ``` It will generate the following on production: ```html @@ -72,9 +74,15 @@ on development: ```html <script src="/assets/jquery.js?body=1" type="text/javascript"></script> +``` + +Be sure to put the following line in `config/application.rb`, as it will be served when CDN is not available. + +```ruby +config.assets.precompile += ['jquery.js'] ``` If you want to check the production URL, you can pass `:force => true` as an option. ```ruby