Minify html
This commit is contained in:
parent
11f88bbd03
commit
d1607c74e3
12
.eleventy.js
12
.eleventy.js
@ -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)
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user