stop messing with asset pipeline defaults

stripping postfixes is wasteful and uneeded. It messes up our build
This commit is contained in:
Sam 2013-12-19 12:33:17 +11:00
parent 9cecabd023
commit 66afabcf4c
2 changed files with 13 additions and 19 deletions

View File

@ -37,6 +37,9 @@ Discourse::Application.configure do
config.pbkdf2_iterations = 10
config.ember.variant = :development
config.assets.compile = true
config.assets.digest = false
# silence deprecation warnings in test
config.whiny_nils = true unless rails4?
config.eager_load = false if rails4?

View File

@ -1,23 +1,14 @@
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
next if File.extname(file) == ".json" # Avoid duplicate manifest
source = file.split('/')
source.push(source.pop.gsub(regex, '.'))
task 'assets:precompile:before' do
non_digested = File.join(source)
FileUtils.cp(file, non_digested)
end
puts "> Removing cache"
`rm -fr tmp/cache`
unless %w{profile production}.include? Rails.env
raise "rake assets:precompile should only be run in RAILS_ENV=production, you are risking unminified assets"
end
# in the past we applied a patch that removed asset postfixes, but it is terrible practice
# leaving very complicated build issues
# https://github.com/rails/sprockets-rails/issues/49
end
task 'assets:precompile' => 'assets:precompile:before'