Created
May 14, 2011 19:11
-
-
Save christopherhein/972517 to your computer and use it in GitHub Desktop.
Asset Packaging asset_hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionController::Base.asset_host = Proc.new { |source| | |
img = %w(.png .jpg .gif .jpeg) | |
ext = File.extname(source).split("?")[0] | |
if img.include?(ext) | |
"http://assets1.example.com" | |
elsif ext == '.js' | |
"http://assets2.example.com" | |
elsif ext == '.css' | |
"http://assets3.example.com" | |
else | |
"http://assets4.example.com" | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment