17 lines
488 B
JavaScript
17 lines
488 B
JavaScript
import htmlmin from 'html-minifier-terser';
|
|
|
|
export const htmlConfig = (eleventyConfig) => {
|
|
eleventyConfig.addTransform('html-minify', (content, path) => {
|
|
if (path && (path.endsWith('.html') || path.endsWith('.php'))) {
|
|
return htmlmin.minify(content, {
|
|
collapseBooleanAttributes: true,
|
|
collapseWhitespace: true,
|
|
decodeEntities: true,
|
|
includeAutoGeneratedTags: false,
|
|
removeComments: true
|
|
});
|
|
}
|
|
|
|
return content;
|
|
});
|
|
};
|