12 lines
516 B
Ruby
12 lines
516 B
Ruby
#!/usr/bin/env ruby
|
|
extensions = %w[jpg jpeg png js css gif svg json woff eot ttf otf ]
|
|
start_time = Time.now
|
|
Dir.glob(File.join('public/assets/**', "*.{#{extensions.join(',')}}")).each do |asset_path|
|
|
next unless asset_path =~ /-[a-f0-9]{32}\.(#{extensions.join('|')})\Z/
|
|
dedigest_path = asset_path.sub(/-[a-f0-9]{32}/, '')
|
|
#`mv '#{asset_path}' '#{dedigest_path}' 2>/dev/null`
|
|
`mv '#{asset_path}' '#{dedigest_path}'`
|
|
end
|
|
end_time = Time.now
|
|
puts "Dedigested assets in #{(end_time - start_time).round} seconds}"
|