-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Google's CDN to host jQuery #61
Comments
+1 |
I agree that CDN support would be great if it's included in jquery-rails, but I also think To become as a default in Rails, better abstraction (no inclusion of |
Sooo... maybe I'm not getting something, but since there's already a gem that does this, why is it valuable to include this in jquery-rails? |
I personally think it would be a good default. If a large majority of Rails apps are using Most developers won't care about this enough to do anything, so in order for the CDN idea to get any traction, it needs to be adopted by the gem they already use. |
But you just said that the CDN version would have to be installed by a generator. That means that developers would have to care enough about this to do something, which you just said they won't do. How is this worthwhile either way? If developers do care, they can add the CDN version by adding four characters to their Gemfile, and if they don't care, adding a generator to this gem won't help them anyway. On Jul 11, 2012, at 10:46 PM, Nathan Broadbentreply@reply.github.com wrote:
|
-1 this isn't appropriate for Ruby on Rails which takes Open Source very seriously. A rails app by default shouldn't rely on proprietary infrastructure. Also google gets ip addresses and referrers which can be logged when someone visits a site that has CDN jQuery and doesn't have it cached. |
OK, I agree that the Open Source / proprietary infrustructure part makes some sense. It's a shame though, since Google's CDNs does provide a great service with the best intentions, and it would become even more effective if more websites started using it. Oh well, thanks for everyone's input. I will close this issue for now :) |
-1 This would mean having a separate request for jquery. |
@mariovisic It will only hurt the performance, if the specific version is not already in the browser cache. In most cases, it will, since many sites use Google's CDN. The widely used HTML5Boilerplate also uses Google's CDN for jQuery. @ndbroadbent If there is any interest, I would develop a patch, which provides the functionality as an option, not enabled by default. |
+1 by making this a default in rails it would help grow the base of sites out there, and increase the likelihood of any given browser having it cached |
@ndbroadbent Exactly, if it's a default, most people will not change it without a good reason and everyone benefits. Anyone who wants to change it for a good reason (or a bad reason) is perfectly entitled to. |
+1 |
@ptrsghr, this isn't going to be added to jquery-rails. If you want your Rails site to serve jQuery from a CDN, use the "jquery-rails-cdn" gem instead. |
Here's a gem that already provides this behaviour: https://github.com/kenn/jquery-rails-cdn
I think this should be the default behaviour of the
jquery-rails
gem.It seems like a waste of resources if we are all compiling our own copies of jQuery and jquery-ui into our
application.js
.Sites like Twitter, Stack Overflow, Posterous, and Foursquare are ensuring that your users will already have a cached copy of jQuery ready for you to use, because they all reference Google's CDN. This provides cross-site caching.
You may find it helpful to read the following articles:
In order to implement this, we would need to provide an install generator (
rails g jquery:install
), since we'll need to make some changes to the Rails application://= require jquery
fromapplication.js
= jquery_include_tag :google_schemeless
to your layoutconfig.assets.precompile += ['jquery.js']
toapplication.rb
(provides a fallback in case Google's CDN goes down, is blocked, you're offline, etc.)The text was updated successfully, but these errors were encountered: