jquery-rails-cdn 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -12,20 +12,23 @@ Serving jQuery from a publicly available [CDN](http://en.wikipedia.org/wiki/Cont
12
12
 
13
13
  This gem offers the following features:
14
14
 
15
- * Supports multiple CDN. (Google, Microsoft and jquery.com)
16
- * jQuery version is automatically detected via jquery-rails.
15
+ * Supports multiple CDN. (Google, Microsoft, jquery.com, etc.)
16
+ * jQuery version is automatically detected via `jquery-rails`.
17
17
  * Automatically fallback to jquery-rails' bundled jQuery when:
18
18
  * You're on a development environment, so that you can work offline.
19
- * The CDN is down or unavailable.
19
+ * The CDN is down or unreachable.
20
20
 
21
- 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:
21
+ 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:
22
22
 
23
- * Updating your js code won't evict the entire cache in browsers - your code changes more often than jQuery upgrades, right?
24
- * `rake assets:precompile` takes less peak memory usage.
23
+ * Updating your JS code won't evict the entire cache in browsers.
24
+ * Cached jQuery in the client browsers will survive deployments.
25
+ * Your code changes more often than jQuery upgrades, right?
26
+ * `rake assets:precompile` will run faster and use less memory.
25
27
 
26
28
  Changelog:
27
29
 
28
- * v0.1.0: Added :google_schemeless for sites that support both ssl / non-ssl
30
+ * v0.2.0: (Incompatible Change) Google CDN is now always scheme-less. Add Yandex CDN for Russian users. (Thanks to @ai)
31
+ * v0.1.0: Added `:google_schemeless` for sites that support both ssl / non-ssl
29
32
  * v0.0.1: Initial release
30
33
 
31
34
  ## Installation
@@ -38,7 +41,7 @@ gem 'jquery-rails-cdn'
38
41
 
39
42
  ## Usage
40
43
 
41
- 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.
44
+ This gem adds two methods `jquery_include_tag` to generate a script tag to the jQuery on a CDN of your preference.
42
45
 
43
46
  If you're using asset pipeline with Rails 3.1+, first remove `//= require jquery` from `application.js`.
44
47
 
@@ -53,10 +56,9 @@ Note that valid CDN symbols are:
53
56
 
54
57
  ```ruby
55
58
  :google
56
- :google_ssl
57
- :google_schemeless
58
59
  :microsoft
59
60
  :jquery
61
+ :yandex
60
62
  ```
61
63
 
62
64
  It will generate the following on production:
@@ -76,6 +78,12 @@ on development:
76
78
  <script src="/assets/jquery.js?body=1" type="text/javascript"></script>
77
79
  ```
78
80
 
81
+ Be sure to put the following line in `config/application.rb`, as it will be served when CDN is not available.
82
+
83
+ ```ruby
84
+ config.assets.precompile += ['jquery.js']
85
+ ```
86
+
79
87
  If you want to check the production URL, you can pass `:force => true` as an option.
80
88
 
81
89
  ```ruby
@@ -6,11 +6,10 @@ module Jquery::Rails::Cdn
6
6
  JQUERY_VERSION = Jquery::Rails::JQUERY_VERSION
7
7
  OFFLINE = (Rails.env.development? or Rails.env.test?)
8
8
  URL = {
9
- :google => "http://ajax.googleapis.com/ajax/libs/jquery/#{JQUERY_VERSION}/jquery.min.js",
10
- :google_ssl => "https://ajax.googleapis.com/ajax/libs/jquery/#{JQUERY_VERSION}/jquery.min.js",
11
- :google_schemeless => "//ajax.googleapis.com/ajax/libs/jquery/#{JQUERY_VERSION}/jquery.min.js",
9
+ :google => "//ajax.googleapis.com/ajax/libs/jquery/#{JQUERY_VERSION}/jquery.min.js",
12
10
  :microsoft => "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-#{JQUERY_VERSION}.min.js",
13
- :jquery => "http://code.jquery.com/jquery-#{JQUERY_VERSION}.min.js"
11
+ :jquery => "http://code.jquery.com/jquery-#{JQUERY_VERSION}.min.js",
12
+ :yandex => "http://yandex.st/jquery/#{JQUERY_VERSION}/jquery.js"
14
13
  }
15
14
 
16
15
  def jquery_url(name, options = {})
@@ -1,7 +1,7 @@
1
1
  module Jquery
2
2
  module Rails
3
3
  module Cdn
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-rails-cdn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-23 00:00:00.000000000 Z
12
+ date: 2012-08-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails