Minify html

This commit is contained in:
eggy 2021-07-10 22:25:31 -04:00
parent 11f88bbd03
commit d1607c74e3
2 changed files with 14 additions and 1 deletions

View File

@ -1,10 +1,22 @@
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight')
const markdownIt = require('markdown-it')
const markdownItAnchor = require('markdown-it-anchor')
const htmlmin = require("html-minifier")
module.exports = function(eleventyConfig) {
// Plugins
eleventyConfig.addPlugin(syntaxHighlight)
eleventyConfig.addTransform("htmlmin", (content, outputPath) => {
if (outputPath.endsWith(".html")) {
return htmlmin.minify(content, {
collapseWhitespace: true,
removeComments: true,
useShortDoctype: true,
});
}
return content;
});
// To enable merging of tags
eleventyConfig.setDataDeepMerge(true)

View File

@ -16,7 +16,8 @@
"devDependencies": {
"@11ty/eleventy": ">=0.11.1",
"@11ty/eleventy-plugin-syntaxhighlight": ">=3.0.4",
"eslint": ">=7.12.1"
"eslint": ">=7.12.1",
"html-minifier": ">=3.5.21"
},
"dependencies": {
"@tailwindcss/typography": "^0.4.0",