2023-09-10 13:27:24 +03:00
|
|
|
const htmlmin = require("html-minifier");
|
|
|
|
|
2023-09-10 13:30:50 +03:00
|
|
|
module.exports = function (eleventyConfig) {
|
|
|
|
eleventyConfig.addTransform("htmlmin", function (content, outputPath) {
|
|
|
|
if (outputPath.endsWith(".html")) {
|
|
|
|
let minified = htmlmin.minify(content, {
|
|
|
|
useShortDocType: true,
|
|
|
|
removeComments: true,
|
|
|
|
collapseWhitespace: true,
|
|
|
|
});
|
2023-09-10 13:27:24 +03:00
|
|
|
|
2023-09-10 13:30:50 +03:00
|
|
|
return minified;
|
2023-09-10 13:14:46 +03:00
|
|
|
}
|
2023-09-10 13:30:50 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
|
|
|
dir: {
|
|
|
|
input: "src",
|
|
|
|
output: "dist",
|
|
|
|
includes: "includes",
|
|
|
|
layouts: "layouts",
|
|
|
|
data: "data",
|
|
|
|
},
|
|
|
|
dataTemplateEngine: "njk",
|
|
|
|
};
|
|
|
|
};
|