lib/propshaft/processor.rb in propshaft-0.3.0 vs lib/propshaft/processor.rb in propshaft-0.3.1
- old
+ new
@@ -1,8 +1,7 @@
class Propshaft::Processor
MANIFEST_FILENAME = ".manifest.json"
- COMPRESSABLE_CONTENT_TYPES = %i[ js css text json xml html svg otf ttf ].collect { |t| Mime[t] }
attr_reader :load_path, :output_path, :compilers
def initialize(load_path:, output_path:, compilers:)
@load_path, @output_path = load_path, output_path
@@ -11,11 +10,10 @@
def process
ensure_output_path_exists
write_manifest
output_assets
- compress_assets
end
def clobber
FileUtils.rm_r(output_path) if File.exist?(output_path)
end
@@ -58,22 +56,7 @@
end if compilers.compilable?(asset)
end
def copy_asset(asset)
FileUtils.copy asset.path, output_path.join(asset.digested_path)
- end
-
-
- def compress_assets
- load_path.assets(content_types: COMPRESSABLE_CONTENT_TYPES).each do |asset|
- compress_asset output_path.join(asset.digested_path)
- end if compressor_available?
- end
-
- def compress_asset(path)
- `brotli #{path} -o #{path}.br` unless Pathname.new(path.to_s + ".br").exist?
- end
-
- def compressor_available?
- `which brotli`.present?
end
end