mirror of
https://github.com/discourse/discourse.git
synced 2026-08-26 05:07:42 -05:00
Provides the ability to skip minification of some JS assets.
This commit is contained in:
@@ -136,6 +136,8 @@ task 'assets:precompile' => 'assets:precompile:before' do
|
||||
if $node_uglify
|
||||
puts "Compressing Javascript and Generating Source Maps"
|
||||
manifest = Sprockets::Manifest.new(assets_path)
|
||||
|
||||
to_skip = Rails.configuration.assets.skip_minification || []
|
||||
manifest.files
|
||||
.select{|k,v| k =~ /\.js$/}
|
||||
.each do |file, info|
|
||||
@@ -148,14 +150,17 @@ task 'assets:precompile' => 'assets:precompile:before' do
|
||||
STDERR.puts "Skipping: #{file} already compressed"
|
||||
else
|
||||
STDERR.puts "Compressing: #{file}"
|
||||
FileUtils.mv(path, _path)
|
||||
compress(_file,file)
|
||||
|
||||
# We can specify some files to never minify
|
||||
unless to_skip.include?(info['logical_path'])
|
||||
FileUtils.mv(path, _path)
|
||||
compress(_file,file)
|
||||
end
|
||||
|
||||
info["size"] = File.size(path)
|
||||
info["mtime"] = File.mtime(path).iso8601
|
||||
gzip(path)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# protected
|
||||
|
||||
Reference in New Issue
Block a user