Minify HTML files with html-minifier-terser.
npm install hexo-html-minifier-terser
Minify HTML files with html-minifier-terser.
`` bash`
$ npm install html-minifier-terser --save
You can set options of HTMLMinifier in the main _config.yml file:
` yaml`
html_minifier:
exclude:
- exclude: Exclude files from being minified. Support globbing patterns.
Default options:
` yaml`
html_minifier:
collapseBooleanAttributes: true
collapseWhitespace: true
# Ignore '' https://hexo.io/docs/tag-plugins#Post-Excerpt
ignoreCustomComments: [ !!js/regexp /^\s*more/]
removeComments: true
removeEmptyAttributes: true
removeScriptTypeAttributes: true
removeStyleLinkTypeAttributes: true
minifyJS: true
minifyCSS: true
- ignoreCustomComments: Array of regex'es that allow to ignore certain comments, when matched. Need to prepend !!js/regexp` to support regex.
Description of the above options and other available options, see HTMLMinifier