Transforms
Transforms process built output. The prettier, htmlmin, & clean-attrs
modules export factories that return a function to pass to addTransform;
postcss exports a helper for CSS bundles. Peer dependencies load on first
use, so a transform only needs its package when it runs.
clean-attrs
Eleventy transform that strips eleventy:ignore="" markers left on <img>
tags inside <picture> elements. The official
eleventyImageTransformPlugin only clears the attribute on bare <img>
elements; this transform finishes the job.
| Export | Description |
|---|---|
createCleanAttrsTransform(options?) |
Create the attribute-cleanup transform. |
htmlmin
Eleventy transform that minifies HTML output via html-minifier-terser.
Requires html-minifier-terser as a peer dependency.
| Export | Description |
|---|---|
createHtmlMinTransform(options?) |
Create the HTML minification transform. |
postcss
PostCSS processing helper for Eleventy bundles or addExtension('css', ...)
setups. Requires postcss as a peer dependency.
| Export | Description |
|---|---|
processCSS(content, inputPath, outputPath, config?) |
Run a CSS string through PostCSS using the plugins and options supplied in config (the shape returned by postcss-load-config). |
prettier
Eleventy transform that runs Prettier over HTML, XML, and SVG output.
Requires prettier as a peer dependency.
| Export | Description |
|---|---|
createPrettierTransform(options?) |
Create the Prettier transform. |