Multi Asset Locations plugin
Plugin details
Documentation
ruby script/plugin install http://simple-rails-plugins.googlecode.com/svn/multi-asset-locations/
Normally in rails you have one location, and one location only for all of your assets, being images, stylesheet or javascripts.
Since browsers usually have a limit of 2 downloading pipelines (http pipelining | http://en.wikipedia.org/wiki/HTTP_pipelining) per domain, it means that the more domains you serve your assets from, the more concurrent downloads you can have, the quicker the page download happens. Couple this technique with minizing and gzipping for maximum result.
Normally you can now set your ActionController::Base.asset_host to only one location by passing a string.
ActionController::Base.asset_host = "http://myasset.domain.com"
Once you do that your image_tag, include_javascript_tag, stylesheet_link_tag are all served from that domain. (the default is an empty string)
With this plugin you can choose to pass either a string or a hash. The acceptable keys are :javascripts, :stylesheets and :images. You can pass either one or all of the keys.
For Ex.:
ActionController::Base.asset_host = {:images => "http://images.domain.com", :javascripts => "http://javascripts.domain.com", :stylesheets => "http://stylesheets.domain.com"} ActionController::Base.asset_host = {:stylesheets => "http://stylesheets.domain.com"}
For more info on how to optimize your page load time, check out: http://www.die.net/musings/page_load_time/
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, 10 months ago

