Skip to content
Create a gist now

Instantly share code, notes, and snippets.

namespace :assets do
desc "Make all embedded assets in stylesheets relative paths"
task :relativize => :environment do
Dir[Rails.root + "public/assets/*.css"].each do |asset|
contents = File.read(asset)
File.open(asset, "w") do |file|
file.puts contents.gsub("url(/assets/", "url(../")
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.