Skip to content

Instantly share code, notes, and snippets.

@rilian
Created June 6, 2017 13:47
Show Gist options
  • Save rilian/16b436bdba34b6fa4539afe39e719967 to your computer and use it in GitHub Desktop.
Save rilian/16b436bdba34b6fa4539afe39e719967 to your computer and use it in GitHub Desktop.
copy-non-digest-assets.txt
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.cp(file, non_digested)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment