Last active
December 15, 2015 06:48
-
-
Save ashchan/5218487 to your computer and use it in GitHub Desktop.
Symbolink to digested assets (w/ fingerprint)
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
namespace :assets do | |
desc "link nondigest application.css" | |
task :link_nondigest => :environment do | |
manifest = Dir.glob("#{Rails.root}/public/assets/manifest-*.json").first | |
nondigest = "application.css" | |
json = JSON.parse(open(manifest).read) | |
css = json["files"].select { |_, f| f["logical_path"] == nondigest } | |
.sort_by { |_, v| Time.parse(v["mtime"]) } | |
.last.first | |
`rm #{Rails.root}/public/assets/#{nondigest}` | |
`ln -s #{Rails.root}/public/assets/#{css} #{Rails.root}/public/assets/#{nondigest}` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment