Bunble cleanup, including minifying HTML, CSS, JS and Image files, and do `useref` on HTML files.
npm install hexo-filter-cleanup[![npm version][npm-version-image]][download-url]
[![NPM Dependencies][npm-dep-image]][npm-dep-url]
[![NPM DevDependencies][npm-devdep-image]][npm-devdep-url]
[![npm download][download-image]][download-url]
[npm-version-image]: https://badge.fury.io/js/hexo-filter-cleanup.svg
[npm-dep-image]: https://david-dm.org/mamboer/hexo-filter-cleanup.svg
[npm-dep-url]: https://david-dm.org/mamboer/hexo-filter-cleanup
[npm-devdep-image]: https://david-dm.org/mamboer/hexo-filter-cleanup/dev-status.svg
[npm-devdep-url]: https://david-dm.org/mamboer/hexo-filter-cleanup?type=dev
[download-image]: https://img.shields.io/npm/dm/hexo-filter-cleanup.svg?style=flat-square
[download-url]: https://www.npmjs.com/package/hexo-filter-cleanup
> This project is inspired by hexo-all-minifier.
I completely re-wrote this hexo filter plugin because hexo-all-minifier has certain issues as below which sucks my hexo project on mac osx platform. Besides that i have added some other cool features like useref and performance improvements.
All in one. Minifier & Optimization plugin for Hexo.
`` bash`
$ npm install hexo-filter-cleanup --save
or with yarn,
`bash`
yarn add hexo-filter-cleanup
Integrate all the official minifier plugins of HEXO and some other optimization plugins:
- hexo-html-minifier, which is based on HTMLMinifier
- hexo-clean-css, which is based on clean-css
- hexo-uglify, which is based on UglifyJS
- hexo-imagemin, which is based on imagemin
- useref, let hexo parse build blocks in html files.
- favicons, generate favicons on the fly.
Thanks for their works.
` yaml`
hfc_useref:
enable: true
concat: true
exclude: true
- enable - Enable the plugin. Defaults to .
- exclude: Exclude files
- concat: concat the referenced files automatically.
----------
` yaml`
hfc_html:
enable: true
exclude: true
- enable - Enable the plugin. Defaults to .
- exclude: Exclude files
----------
` yaml`
hfc_css:
enable: true
exclude:
- '*.min.css'true
- enable - Enable the plugin. Defaults to .
- exclude: Exclude files
----------
` yaml`
hfc_js:
enable: true
mangle: true
compress:
exclude:
- '*.min.js'true
- enable - Enable the plugin. Defaults to .
- mangle: Mangle file names
- compress: Compress options
- exclude: Exclude files
----------
`yaml`
hfc_img:
enable: true
interlaced: false
multipass: false
optimizationLevel: 2
pngquant: false
progressive: false
webp: true
webpQuality: 75
gifslice: true
jpegtran: true
jpegrecompress: false
jpegrecompressQuality: 'medium'
optipng: true
svgo: truetrue
- enable - Enable the plugin. Defaults to .false
- interlaced - Interlace gif for progressive rendering. Defaults to .false
- multipass - Optimize svg multiple times until it’s fully optimized. Defaults to .2
- optimizationLevel - Select an optimization level between 0 and 7. Defaults to .false
- pngquant - Enable imagemin-pngquant plugin. Defaults to .false
- progressive - Lossless conversion to progressive. Defaults to .
`yaml`
hfc_favicons:
enable: true
src: img/logo.png
target: img/
html: true
opts: false
icons:
android: true
appleIcon: true
appleStartup: false
coast: false
favicons: true
firefox: false
opengraph: false
windows: true
yandex: falsetrue
- enable - Enable the plugin. Defaults to .img
- src - Favicon file path.
- target - Where we put the generated files. Defaults to folder._data
- html - Whether generate the html data in the folder for further usage. Defaults to true. See an example.false
- opts - Extra favicons configurations. Defaults to
- icons - Icons configurations.
The debug mode will disable all the optimizations.
You can active the debug mode by using hexo's --debug switch as below.
```
hexo s --watch --debug
Todo: Tests