rollup-plugin-gzip

  • Version 4.0.1
  • Published
  • 23.6 kB
  • No dependencies
  • MIT license

Install

npm i rollup-plugin-gzip
yarn add rollup-plugin-gzip
pnpm add rollup-plugin-gzip

Overview

Compress your Rollup / Vite bundle with Gzip or Brotli

Index

Functions

function gzipPlugin

gzipPlugin: (explicitOptions?: GzipPluginOptions) => Plugin;

    Interfaces

    interface GzipPluginOptions

    interface GzipPluginOptions {}

      property additionalFiles

      additionalFiles?: string[];
      • This option allows you to compress additional files outside of the main rollup bundling process. The processing is delayed to make sure the files are written on disk; the delay is controlled through additionalFilesDelay.

      property additionalFilesDelay

      additionalFilesDelay?: number;
      • This options sets a delay (ms) before the plugin compresses the files specified through additionalFiles. Increase this value if your artifacts take a long time to generate.

        Defaults to 0

      property customCompression

      customCompression?: CustomCompressionOption;
      • Set a custom compression algorithm. The function can either return the compressed contents synchronously, or otherwise return a promise for asynchronous processing.

      property fileName

      fileName?: string | StringMappingOption;
      • Set a custom file name convention for the compressed files. Can be a suffix string or a function returning the file name.

        Defaults to .gz

      property filter

      filter?: RegExp | ((fileName: string) => boolean);
      • Control which of the output files to compress

        Defaults to /\.(js|mjs|json|css|html)$/

      property gzipOptions

      gzipOptions?: ZlibOptions;
      • GZIP compression options, see https://nodejs.org/api/zlib.html#zlib_class_options

      property minSize

      minSize?: number;
      • Specified the minimum size in Bytes for a file to get compressed. Files that are smaller than this threshold will not be compressed. This does not apply to the files specified through additionalFiles!

      Type Aliases

      type CustomCompressionOption

      type CustomCompressionOption = (
      content: string | Buffer
      ) => string | Buffer | Promise<string | Buffer>;

        type StringMappingOption

        type StringMappingOption = (originalString: string) => string;

          Package Files (1)

          Dependencies (0)

          No dependencies.

          Dev Dependencies (14)

          Peer Dependencies (1)

          Badge

          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/rollup-plugin-gzip.

          • Markdown
            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/rollup-plugin-gzip)
          • HTML
            <a href="https://www.jsdocs.io/package/rollup-plugin-gzip"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>