chore: cleanup and refactor
This commit is contained in:
parent
b6fb54ab98
commit
5295a6eacc
37 changed files with 285 additions and 356 deletions
18
config/transforms/html-config.js
Normal file
18
config/transforms/html-config.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
const htmlmin = require('html-minifier-terser')
|
||||
const isProduction = process.env.ELEVENTY_ENV === 'production'
|
||||
|
||||
module.exports = (eleventyConfig) => {
|
||||
eleventyConfig.addTransform('html-minify', (content, path) => {
|
||||
if (path && path.endsWith('.html') && isProduction) {
|
||||
return htmlmin.minify(content, {
|
||||
collapseBooleanAttributes: true,
|
||||
collapseWhitespace: true,
|
||||
decodeEntities: true,
|
||||
includeAutoGeneratedTags: false,
|
||||
removeComments: true,
|
||||
})
|
||||
}
|
||||
|
||||
return content
|
||||
})
|
||||
}
|
Reference in a new issue