mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Update assets #2723
This commit is contained in:
parent
d3ddab0e08
commit
ad1c24712e
17 changed files with 112921 additions and 382 deletions
|
@ -4,16 +4,11 @@ end
|
|||
|
||||
namespace :assets do
|
||||
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
|
||||
manifest_path = Dir.glob(File.join(Rails.root, 'public/assets/.sprockets-manifest-*.json')).first
|
||||
manifest_data = JSON.load(File.new(manifest_path))
|
||||
|
||||
source = file.split('/')
|
||||
source.push(source.pop.gsub(regex, '.'))
|
||||
|
||||
non_digested = File.join(source)
|
||||
FileUtils.cp(file, non_digested)
|
||||
manifest_data["assets"].each do |logical_path, digested_path|
|
||||
FileUtils.cp("public/assets/#{digested_path}", "public/assets/#{logical_path}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue