20 lines
563 B
JavaScript
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;
|
|
});
|
|
};
|