Skip to content

Instantly share code, notes, and snippets.

@gotbadger
Created August 16, 2016 14:42
Show Gist options
  • Save gotbadger/4b7945aab5f6964e80ae6ce02ef4ecb3 to your computer and use it in GitHub Desktop.
Save gotbadger/4b7945aab5f6964e80ae6ce02ef4ecb3 to your computer and use it in GitHub Desktop.
Somtimes you need to diff the output of rake assets:precompile run this script after to remove fingerprints
task non_digested: :environment do
assets = Dir.glob(File.join(Rails.root, 'public/assets/**/*'))
regex = /(-{1}[a-z0-9]{32}*\.{1}){1}/
assets.each do |file|
next if File.directory?(file) || file !~ regex
source = file.split('/')
source.push(source.pop.gsub(regex, '.'))
non_digested = File.join(source)
FileUtils.mv(file, non_digested)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment