An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# hexo-html-minifier

[![Build Status](https://github.com/hexojs/hexo-html-minifier/workflows/Tester/badge.svg)](https://github.com/hexojs/hexo-html-minifier/actions?query=workflow%3ATester)
[![NPM version](https://badge.fury.io/js/hexo-html-minifier.svg)](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)