class Sprockets::Exporters::ZlibExporter
Generates a ‘.gz` file using the zlib algorithm built into Ruby’s standard library.
Public Instance Methods
call()
click to toggle source
# File lib/sprockets/exporters/zlib_exporter.rb, line 26 def call write(@gzip_target) do |file| @gzip.compress(file, target) end end
setup()
click to toggle source
# File lib/sprockets/exporters/zlib_exporter.rb, line 9 def setup @gzip_target = "#{ target }.gz" @gzip = Sprockets::Utils::Gzip.new(asset, archiver: Utils::Gzip::ZlibArchiver) end
skip?(logger)
click to toggle source
# File lib/sprockets/exporters/zlib_exporter.rb, line 14 def skip?(logger) return true if environment.skip_gzip? return true if @gzip.cannot_compress? if ::File.exist?(@gzip_target) logger.debug "Skipping #{ @gzip_target }, already exists" true else logger.info "Writing #{ @gzip_target }" false end end