Now with Partition Management

    eleventy-plugin-compress
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.2 • Public • Published

    eleventy-plugin-compress 👜

    code style: prettier

    Compresses HTML and assets (CSS, JavaScript) that are referenced from it with brotli, gzip and deflate algorithms.

    Intention

    Even big assets(pages, scripts, styles) should be delivered to client quickly. In order to do that, they must be compressed ☝️! ... At least.

    Get started

    Installation

    At first run:

    npm i -D eleventy-plugin-compress

    and eventually add to Eleventy as plugin:

    const { compress } = require('eleventy-plugin-compress');
    
    module.exports = (eleventyConfig) => {
      eleventyConfig.addPlugin(compress, {
        /* Optional options. */
      });
    };

    Important: you should register plugin after any other plugins or transform functions!

    Options

    The plugin can accept following options:

    type CompressAlgorithm = 'brotli' | 'gzip' | 'deflate';
    
    interface CompressPluginOptions {
      /**
       * Signals whether this plugin should do its job.
       * By default, it is on in production environment.
       */
      enabled?: boolean;
      algorithm?: CompressAlgorithm | ReadonlyArray<CompressAlgorithm>;
    }

    You can choose one of some algorithms to compress assets. By default, brotli is used.

    For proper work of this plugin, it is assumed that in time of compiling HTML all CSS and JavaScript are already processed and folded into output directory.

    Word from author

    Have fun! ✌️

    Developed in Halo lab

    Install

    npm i eleventy-plugin-compress

    DownloadsWeekly Downloads

    90

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    25.4 kB

    Total Files

    43

    Last publish

    Collaborators

    • halolab