diff --git a/eleventy.config.js b/eleventy.config.js
index 54f899c..82a950d 100644
--- a/eleventy.config.js
+++ b/eleventy.config.js
@@ -1,6 +1,7 @@
import eleventyPluginNavigation from '@11ty/eleventy-navigation';
import eleventyPluginWebc from '@11ty/eleventy-plugin-webc';
import { eleventyImagePlugin } from '@11ty/eleventy-img';
+import htmlminifier from 'html-minifier-terser';
const IMAGE_TRANSFORM_OPTS = {
// Set global default options
@@ -31,8 +32,24 @@ export default async function (eleventyConfig) {
collection.getFilteredByGlob('./src/jarek/*.md')
);
+ eleventyConfig.addTransform('minhtml', function (content) {
+ if ((this.page.outputPath || '').endsWith('.html')) {
+ return htmlminifier.minify(content, {
+ // keepClosingSlash: true,
+ removeEmptyElements: true,
+ collapseWhitespace: true,
+ ignoreCustomFragments: [
+ /<(use|path)[^>]*>(?:(?!<\/(use|path)>)[\s\S])*?<\/(use|path)>/,
+ /
]*class="color-box"[^>]*>(?:(?!<\/div>)[\s\S])*?<\/div>/,
+ /