htmlmin
In Transforms
Eleventy transform that minifies HTML output via html-minifier-terser.
Requires html-minifier-terser as a peer dependency.
import {
createHtmlMinTransform,
} from '@allons-y/dashly/transforms/htmlmin';
createHtmlMinTransform(options?)
Create the HTML minification transform. By default it runs only when
process.env.ELEVENTY_ENV === 'production'; pass production: false to
always run or production: true to enforce the gate explicitly.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
options
(optional)
|
object |
||
options.production
(optional)
|
boolean |
When true, only run in production. Defaults to true. | |
options.minifier
(optional)
|
import('html-minifier-terser').Options |
Options forwarded to html-minifier-terser. |
Returns
(content: string, outputPath?: string) => Promise<string>