Module: Sprockets::Utils::Gzip::ZopfliArchiver

Defined in:
lib/sprockets/utils/gzip.rb

Overview

Private: Generates a gzipped file based off of reference asset.

ZopfliArchiver.call(file, source, mtime)

Compresses a given ‘source` using the zopfli gem writes contents to the `file` passed in. Sets `mtime` of written file to passed in `mtime`

Class Method Summary collapse

Class Method Details

.call(file, source, mtime) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/sprockets/utils/gzip.rb', line 31

def self.call(file, source, mtime)
  compressed_source = Autoload::Zopfli.deflate(source, format: :gzip, mtime: mtime)
  file.write(compressed_source)
  file.close

  nil
end