Skip to content

DaanVanVugt/middleman-brotli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Middleman-brotli extension

This extension compresses assets with brotli for maximum shrinkage. Based on the gzip compressor from middleman core.

Installation

Add the gem to your .gemrc

gem 'middleman-brotli', git: 'https://github.com/exteris/middleman-brotli', branch: 'master'

and activate it in your config.rb:

configure :build do
  activate :brotli
end

You might need to apply some other settings to your web server and CDN. See for instance This page.

Options

The files to compress can be selected by extension, with an optional ignore list. Default options are:

  option :exts, %w(.css .htm .html .js .svg .xhtml .otf .woff .ttf .woff2), 'File extensions to compress when building.'
  option :ignore, [], 'Patterns to avoid compressing'
  option :overwrite, false, 'Overwrite original files instead of adding .br extension.'

They can be set as:

configure :build do
  activate :brotli, ignore: 'tinyfile.js'
end

Improvements

  • Detect filetype and apply font, text or generic compression types (Brotli comes with different default dictionaries for these types of files)
  • We could generalize the gzip plugin to just use multiple compression commands

LICENSE

This project is released under the MIT license.

About

Brotli compression as a middleman filter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages