Go to file
weyusi 1dafc72850 Use after_generate instead of before_exit
before_exit was a workaround instead of proper after_generate
Use hexo router instead of filesystem manipulation, so hexo-fs is not required anymore
this approach also allows size comparison of original and compressed file, just like minifier currently have
inspired by
 - https://www.travisgeis.com/2018/04/23/lazy-image-resizing-in-hexo-image-sizes-v2/
 - https://github.com/ottobonn/hexo-image-sizes/blob/master/lib/ImageResizer.js
 - https://github.com/chenzhutian/hexo-all-minifier/blob/master/lib/concatJS.js
 - https://stackoverflow.com/a/39441194
2018-10-05 13:38:55 +09:30
lib Use after_generate instead of before_exit 2018-10-05 13:38:55 +09:30
.gitignore Update dependency 2018-09-27 14:57:16 +09:30
.npmignore Update formatting 2018-09-27 16:31:14 +09:30
.snyk Update snyk policy 2018-09-30 18:01:01 +09:30
.travis.yml Remove hexo from travis 2018-09-28 11:54:17 +09:30
README.md Add brotli compression 2018-09-30 17:00:32 +09:30
index.js Use after_generate instead of before_exit 2018-10-05 13:38:55 +09:30
package-lock.json Use after_generate instead of before_exit 2018-10-05 13:38:55 +09:30
package.json Use after_generate instead of before_exit 2018-10-05 13:38:55 +09:30

README.md

Hexo-yam

npm version Build Status NPM Dependencies Known Vulnerabilities Greenkeeper badge

This project is based on hexo-neat

Yet Another Minifier for Hexo. Minify and compress html, js and css. Support gzip and brotli compressions.

The original package has not been updated for a while. Its outdated dependencies suffer from a minor vulnerability.

All the options are the same, so you can use this as a drop-in replacement.

Installation

$ npm install hexo-yam --save

Usage

To enable this plugin, insert the following to _config.yml:

neat_enable: true

For further customization, see below.

Options

neat_html:
  enable: true
  exclude:
  • enable - Enable the plugin. Defaults to true.
  • logger - Print log switch. Defaults to true.
  • exclude: Exclude files Note: For more options, see 'HTMLMinifier'

neat_css:
  enable: true
  exclude:
    - '*.min.css'
  • enable - Enable the plugin. Defaults to true.
  • logger - Print log switch. Defaults to true.
  • exclude: Exclude files

neat_js:
  enable: true
  mangle: true
  output:
  compress:
  exclude:
    - '*.min.js'
  • enable - Enable the plugin. Defaults to true.
  • mangle: Mangle file names
  • logger - Print log switch. Defaults to true.
  • output: Output options
  • compress: Compress options
  • exclude: Exclude files Note: For more options, see 'UglifyJS'

neat_gzip:
  enable: true
  • enable - Enable the plugin. Defaults to true.
  • logger - Print log switch. Defaults to true.

neat_brotli:
  enable: true
  • enable - Enable the plugin. Defaults to true.
  • logger - Print log switch. Defaults to true.

Credits

All credits go to the following work: