Skip to content

Instantly share code, notes, and snippets.

@christopherhein
Created May 14, 2011 19:11
Show Gist options
  • Save christopherhein/972517 to your computer and use it in GitHub Desktop.
Save christopherhein/972517 to your computer and use it in GitHub Desktop.
Asset Packaging asset_hosts
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