mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 10:14:52 -06:00
Rails 4 changes behavior of precompile not to include originals
This patch will restore rails 3 beavior and fix emoji etc under rails 4
This commit is contained in:
parent
5876b6c71b
commit
cc27c5f363
20
lib/tasks/assets.rake
Normal file
20
lib/tasks/assets.rake
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
task 'assets:precompile' => 'environment' do
|
||||||
|
# see: https://github.com/rails/sprockets-rails/issues/49
|
||||||
|
# a decision was made no longer to copy non-digested assets
|
||||||
|
# this breaks stuff like the emoji plugin. We could fix it,
|
||||||
|
# but its a major pain with little benefit.
|
||||||
|
if rails4?
|
||||||
|
puts "Copying non-digested versions of assets"
|
||||||
|
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
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user