🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@e11ty/eleventy-plugin-html-terser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@e11ty/eleventy-plugin-html-terser

Eleventy Plugin which will pass output through HTML Terser

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

@e11ty/eleventy-plugin-html-terser

An Eleventy plugin for post-processing generated sites through the powerful html-minifier-terser.

Why?

Because terser is dope and does dope shit.

Install

The @11ty/eleventy module is a peer and needs to be installed along side it.

pnpm add @e11ty/eleventy-plugin-html-terser @11ty/eleventy -D

Usage

Pass to the addPlugin method of eleventyConfig within a .eleventy.js or .eleventy.cjs configuration file. You can provide terser options to the terserOption property, which will use the defaults listed below. The runModes[] option allows you to (optionally) control modes that minification applies (defaults to all run modes).

Optionally use with 11ty.ts wrapper for type completions.

const { defineConfig } = require('11ty.ts'); // Optional
const { terser } = require('@e11ty/eleventy-plugin-html-terser');

module.exports = defineConfig(eleventyConfig => {

  eleventyConfig.addPlugin(terser, {
    runModes: [], // Optionally specify the run modes for minification
    terserOptions: {
      collapseWhitespace: true,
      minifyCSS: true,
      minifyJS: true,
      removeComments: true,
      removeRedundantAttributes: true
    }
  });

});

See the available minification options for terser.

License

Apache 2.0

FAQs

Package last updated on 12 Oct 2024

Did you know?

Socket

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