Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 707 Bytes

README.md

File metadata and controls

39 lines (29 loc) · 707 Bytes

ExBrotli

Wrapper around rust-brotli

Installation

def deps do
  [
    {:ex_brotli, "~> 0.6.0"}
  ]
end

Direct usage

ExBrotli.compress/1 takes a binary and compresses using Brotli, returns {:ok, compressed_binary} | {:error, reason} ExBrotli.compress!/1 takes a binary and compresses using Brotli. Raise on error.

Phoenix Asset Compression

Add configuration to Plug.Static.

plug Plug.Static,
 ...
 brotli: true

Then tell Phoenix to also compress with Brotli.

# Compression for asset pipeline
config :phoenix,
  static_compressors: [
    Phoenix.Digester.Gzip,
    ExBrotli.DigesterCompressor
  ]