Skip to content

Instantly share code, notes, and snippets.

@kplawver
Created April 7, 2017 12:14
Show Gist options
  • Save kplawver/594094da36115a9f15bbdef2d606ea85 to your computer and use it in GitHub Desktop.
Save kplawver/594094da36115a9f15bbdef2d606ea85 to your computer and use it in GitHub Desktop.
How to skip including the asset host when precompiling assets, which is pretty important if you use Heroku pipelines and your CDN is different between stages!
namespace :assets do
desc "Unsets the asset host, so it's not included in JS and CSS asset urls during precompile."
task :unset_asset_host => :environment do
ActionController::Base.asset_host = ""
end
Rake::Task["assets:precompile"].enhance(["assets:unset_asset_host"])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment