Permalink
Browse files

Support schemeless URL for Google CDN.

  • Loading branch information...
1 parent 794025e commit 220761c088fc7a6e34655a9ceecf54b5922c411f @kenn committed Apr 23, 2012
Showing with 21 additions and 6 deletions.
  1. +14 −1 README.md
  2. +6 −4 lib/jquery-rails-cdn.rb
  3. +1 −1 lib/jquery-rails-cdn/version.rb
View
@@ -23,6 +23,11 @@ On top of that, if you're using asset pipeline, you may have noticed that the ma
* 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.
+Changelog:
+
+* 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:
@@ -44,7 +49,15 @@ Then in layout:
= javascript_include_tag 'application'
```
-Note that valid CDN symbols are `:google`, `:google_ssl`, `:microsoft` and `:jquery`.
+Note that valid CDN symbols are:
+
+```ruby
+:google
+:google_ssl
+:google_schemeless
+:microsoft
+:jquery
+```
It will generate the following on production:
@@ -3,12 +3,14 @@
module Jquery::Rails::Cdn
module ActionViewExtensions
+ JQUERY_VERSION = Jquery::Rails::JQUERY_VERSION
OFFLINE = (Rails.env.development? or Rails.env.test?)
URL = {
- :google => "http://ajax.googleapis.com/ajax/libs/jquery/#{Jquery::Rails::JQUERY_VERSION}/jquery.min.js",
- :google_ssl => "https://ajax.googleapis.com/ajax/libs/jquery/#{Jquery::Rails::JQUERY_VERSION}/jquery.min.js",
- :microsoft => "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-#{Jquery::Rails::JQUERY_VERSION}.min.js",
- :jquery => "http://code.jquery.com/jquery-#{Jquery::Rails::JQUERY_VERSION}.min.js"
+ :google => "http://ajax.googleapis.com/ajax/libs/jquery/#{JQUERY_VERSION}/jquery.min.js",
+ :google_ssl => "https://ajax.googleapis.com/ajax/libs/jquery/#{JQUERY_VERSION}/jquery.min.js",
+ :google_schemeless => "//ajax.googleapis.com/ajax/libs/jquery/#{JQUERY_VERSION}/jquery.min.js",
+ :microsoft => "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-#{JQUERY_VERSION}.min.js",
+ :jquery => "http://code.jquery.com/jquery-#{JQUERY_VERSION}.min.js"
}
def jquery_url(name, options = {})
@@ -1,7 +1,7 @@
module Jquery
module Rails
module Cdn
- VERSION = "0.0.1"
+ VERSION = "0.1.0"
end
end
end

0 comments on commit 220761c

Please sign in to comment.