Skip to content

Broccoli extension to apply gzip compression to trees using Zopfli

License

Notifications You must be signed in to change notification settings

valpackett/broccoli-zopfli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version npm downloads Build Status MIT License

Broccoli Zopfli gzip plugin

Fork of broccoli-gzip to use Zopfli instead of gzip to perform gzip compression. All credit goes to the original authors of broccoli-gzip.

This version is compatible with Broccoli 1.x.

Uses WebAssembly compiled Zopfli to avoid all the native compilation.

Installation

$ npm i @floatboth/broccoli-zopfli

Example

const zopfliGzipFiles = require('@floatboth/broccoli-zopfli')

const tree = zopfliGzipFiles('app', {
  extensions: ['js', 'css', 'svg']
})

Configuration

zopfliGzipFiles(inputTree, options)


options.extensions {Array} (required)

The file extensions that should be compressed.


options.keepUncompressed {Boolean} (optional, default false)

Whether to keep uncompressed versions of the files in the resulting tree.


options.appendSuffix {Boolean} (optional, default true)

Whether to append the .gz extension suffix to compressed files.


options.numIterations {Number} (optional, default 15)

Maximum amount of times to rerun forward and backward pass to optimize LZ77 compression cost. Good values: 10, 15 for small files, 5 for files over several MB in size or it will be too slow.


options.blockSplitting {Boolean} (optional, default true)

If true, splits the data in multiple deflate blocks with optimal choice for the block boundaries. Block splitting gives better compression.


options.blockSplittingMax {Number} (optional, default 15)

Maximum amount of blocks to split into (0 for unlimited, but this can give extreme results that hurt compression on some files).

License

broccoli-zopfli is, like broccoli-gzip, distributed under the MIT license.

About

Broccoli extension to apply gzip compression to trees using Zopfli

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%