mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: Do not gzip when using uglifier.
This commit is contained in:
parent
374657d9d5
commit
6a33fcf48e
1 changed files with 6 additions and 29 deletions
|
@ -29,38 +29,15 @@ task 'assets:precompile:before' do
|
|||
include GlobalPath
|
||||
|
||||
if $node_uglify
|
||||
# monkey patch asset pipeline not to gzip, compress: false is broken
|
||||
class ::Sprockets::Asset
|
||||
# Save asset to disk.
|
||||
def write_to(filename, options = {})
|
||||
# Gzip contents if filename has '.gz'
|
||||
return if File.extname(filename) == '.gz'
|
||||
|
||||
begin
|
||||
FileUtils.mkdir_p File.dirname(filename)
|
||||
|
||||
File.open("#{filename}+", 'wb') do |f|
|
||||
f.write to_s
|
||||
end
|
||||
|
||||
# Atomic write
|
||||
FileUtils.mv("#{filename}+", filename)
|
||||
|
||||
# Set mtime correctly
|
||||
File.utime(mtime, mtime, filename)
|
||||
|
||||
nil
|
||||
ensure
|
||||
# Ensure tmp file gets cleaned up
|
||||
FileUtils.rm("#{filename}+") if File.exist?("#{filename}+")
|
||||
module ::Sprockets
|
||||
# TODO: https://github.com/rails/sprockets-rails/pull/342
|
||||
# Rails.configuration.assets.gzip = false
|
||||
class Base
|
||||
def skip_gzip?
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
module ::Sprockets
|
||||
|
||||
class UglifierCompressor
|
||||
|
||||
def evaluate(context, locals, &block)
|
||||
|
|
Loading…
Reference in a new issue