@e11ty/eleventy-plugin-html-terser
v0.0.1
Published
11ty Plugin which will pass output through HTML Terser
Downloads
84
Readme
@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 module requires @11ty/eleventy be installed along side it.
pnpm add 11ty-html-terser @11ty/eleventy -D
The
@11ty/eleventy
module is a peer. You need to install it.
Usage
Pass it to the addPlugin
within a .eleventy.js
or .eleventy.cjs
configuration file. Optionally use with 11ty.ts wrapper for type completions.
const { defineConfig } = require('11ty.ts'); // Optional
const { terser } = require('11ty-html-terser');
module.exports = defineConfig(eleventyConfig => {
eleventyConfig.addPlugin(terser, {
onlyProd: false, // Only Run when process.env.ENV === 'prod'
terseOptions: {
// Terser Options
}
})
})
See the available minification options for terserOptions
.