https://github.com/hexojs/hexo-html-minifier
Minify HTML files with HTMLMinifier.
https://github.com/hexojs/hexo-html-minifier
hexo hexo-plugin
Last synced: 6 months ago
JSON representation
Minify HTML files with HTMLMinifier.
- Host: GitHub
- URL: https://github.com/hexojs/hexo-html-minifier
- Owner: hexojs
- License: mit
- Created: 2015-01-26T04:32:06.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2024-06-10T09:50:06.000Z (over 1 year ago)
- Last Synced: 2025-06-04T05:11:20.097Z (7 months ago)
- Topics: hexo, hexo-plugin
- Language: JavaScript
- Homepage:
- Size: 182 KB
- Stars: 27
- Watchers: 9
- Forks: 11
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hexo-html-minifier
[](https://github.com/hexojs/hexo-html-minifier/actions?query=workflow%3ATester)
[](https://www.npmjs.com/package/hexo-html-minifier)
Minify HTML files with [HTMLMinifier](https://github.com/kangax/html-minifier).
## Installation
``` bash
$ npm install hexo-html-minifier --save
```
## Options
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](https://github.com/micromatch/micromatch#extended-globbing).
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`](https://github.com/nodeca/js-yaml#supported-yaml-types) to support regex.
Description of the above options and other available options, see [HTMLMinifier](https://github.com/kangax/html-minifier#options-quick-reference)