Socket
Socket
Sign inDemoInstall

razzle-plugin-compression

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    razzle-plugin-compression

Razzle plugin to Compress bundle


Version published
Weekly downloads
684
decreased by-10.7%
Maintainers
1
Install size
7.43 MB
Created
Weekly downloads
 

Readme

Source

npm version

razzle-plugin-compression

This package contains a plugin to compress assets with Razzle

Usage in Razzle Projects

yarn add razzle-plugin-compression --dev

create a razzle.config.js file in root directory of project (next to the package.json) and put this content inside it

Using the plugin with the default options

// razzle.config.js

module.exports = {
  plugins: ['compression'],
};

With custom options:

// razzle.config.js

module.exports = {
  plugins: [
    {
      name: 'compression',
      options: {
        brotli: true,
        gzip: true,
        compressionPlugin: {},
        brotliPlugin: {
          asset: "[path].br[query]",
          test: /\.(js|css|html|svg)$/,
          threshold: 10240,
          minRatio: 0.7
        }
      }
    }
  ]
};

Please remember that custom options will extends default options using Object.assign. Array WILL NOT BE EXTENDED OR CONCATED, it will override all default plugins.

Options

brotli: boolean (defaults: true)

Set brotli to false if you don't want to compress with brotli compression algorithm.

gzip: boolean (defaults: true)

Set gzip to false if you don't want to compress with gzip compression algorithm.

compressionPlugin: object

default: {}

See compression-webpack-plugin options to override configs.

brotliPlugin: object

default:

{
  asset: "[path].br[query]",
  test: /\.(js|css|html|svg)$/,
  threshold: 10240,
  minRatio: 0.7
}

See brotli-webpack-plugin options to override configs.

Keywords

FAQs

Last updated on 16 Jun 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc