Feature #13088
CDN support to jquery/ui lib
Status: | New | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | Administration | |||
Target version: | Candidate for next major release | |||
Resolution: |
Description
1. add CDN support to jquery/ui lib -> include css and image files
2. Supports multiple CDN. (Google, Microsoft, jquery.com, etc.) -> maybe from config file?
3. jQuery version is automatically detected -> no duplicated
4. Automatically fallback to local bundled if CDN is down or unreachable
History
#1
Updated by Daniel Felix about 8 years ago
- Category set to Administration
- Target version set to Candidate for next major release
1. and 4. could be integrated with something like this (from HTML5 Boilerplate)<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.8.0.min.js"><\/script>')</script>
2. The first line of the above mentioned code could be dynamic, which is generated depending on the settings in the administration.
There could be something like a pulldown (just local, jquery, microsoft, google, etc.)
3. Hm, well an automatic detection could be tricky. Example: jQuery updates to jQuery 2.x which possibly remove some function or change some function definition. This could break some features. I would prefer, that the developers choose which version should be used or not.
#2
Updated by Etienne Massip about 8 years ago
Don't forget that Redmine can be deployed on a LAN not connected to the Internet.
#3
Updated by Jan Niggemann (redmine.org team member) about 8 years ago
Etienne Massip wrote:
Don't forget that Redmine can be deployed on a LAN not connected to the Internet.
Wouldn't that match case no 4?
#4
Updated by Bill Wang about 8 years ago
3. Hm, well an automatic detection could be tricky. Example: jQuery updates to jQuery 2.x which possibly remove some function or change some function definition. This could break some features. I would prefer, that the developers choose which version should be used or not.
I mean what versioin of lib we get from CDN should be same as the version from local bundled.
so it is same API whatever from CDN or local.
#5
Updated by Daniel Felix about 8 years ago
Etienne Massip wrote:
Don't forget that Redmine can be deployed on a LAN not connected to the Internet.
Well this would be handled by my mentioned code above. If the extern server isn't available, the local code would be handled.
OR:
See my point two. If the user selects "none", just the local source would be used.
#6
Updated by Etienne Massip about 8 years ago
I'm not sure Redmine should handle CDN configuration; administrators who want to have assets delivered by CDN should already be able to do such with some config:
ActionController::Base.asset_host = Proc.new { |source|
if source ~= /.*jquery.*/
"//ajax.googleapis.com/ajax/libs/jquery"
end
}
(this is a hand-written untested probably nonfunctional example)
You can add fallback mechanism, etc.
See http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html.
#7
Updated by Jean-Philippe Lang about 8 years ago
JQuery and JQuery-UI are merged in Redmine assets so it wouldn't work. It's hacky anyway and would make the upgrade process painfull. That's the purpose of this request to make using a CDN straightforward.
#8
Updated by Etienne Massip about 8 years ago
Jean-Philippe Lang wrote:
JQuery and JQuery-UI are merged in Redmine assets so it wouldn't work.
That was a non-functionnal example for demonstration purpose.
It's hacky anyway
It's Rails configuration?
and would make the upgrade process painfull.
Why would it be? Could be in config/additional_environment.rb
, couldn't it?
That's the purpose of this request to make using a CDN straightforward.
IMHO this should be handled by the Rails stack since it can be, rather than Redmine.
#9
Updated by Jean-Philippe Lang about 8 years ago
Sure, you can do pretty much everything in additional_environment.rb
if you know about Rails configuration (which changes quite often BTW), Ruby, regexp and all but that's not what we can call "configuration". What I see here is a way to enable a CDN by simply uncommenting something like jquery_cdn: google
in configuration.yml
.