wonderfulfrog.com/config/transforms/html-config.js
2024-02-27 10:33:45 -08:00

20 lines
563 B
JavaScript

const htmlmin = require("html-minifier-terser");
module.exports = (eleventyConfig) => {
eleventyConfig.addTransform("html-minify", (content, path) => {
if (path && path.endsWith(".html")) {
return htmlmin.minify(content, {
collapseBooleanAttributes: true,
collapseWhitespace: true,
decodeEntities: true,
includeAutoGeneratedTags: false,
minifyCSS: true,
minifyJS: true,
minifyURLs: true,
removeComments: true,
useShortDoctype: true,
});
}
return content;
});
};