hexo-filter-cleanup
v1.2.2
Published
Bunble cleanup, including minifying HTML, CSS, JS and Image files, and do `useref` on HTML files.
Readme
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.
Installation
$ npm install hexo-filter-cleanup --saveor with yarn,
yarn add hexo-filter-cleanupFeatures
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.
Options
hfc_useref:
enable: true
concat: true
exclude: - enable - Enable the plugin. Defaults to
true. - exclude: Exclude files
- concat: concat the referenced files automatically.
hfc_html:
enable: true
exclude: - enable - Enable the plugin. Defaults to
true. - exclude: Exclude files
hfc_css:
enable: true
exclude:
- '*.min.css'- enable - Enable the plugin. Defaults to
true. - exclude: Exclude files
hfc_js:
enable: true
mangle: true
compress:
exclude:
- '*.min.js'- enable - Enable the plugin. Defaults to
true. - mangle: Mangle file names
- compress: Compress options
- exclude: Exclude files
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: true- enable - Enable the plugin. Defaults to
true. - interlaced - Interlace gif for progressive rendering. Defaults to
false. - multipass - Optimize svg multiple times until it’s fully optimized. Defaults to
false. - optimizationLevel - Select an optimization level between 0 and 7. Defaults to
2. - pngquant - Enable imagemin-pngquant plugin. Defaults to
false. - progressive - Lossless conversion to progressive. Defaults to
false.
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: false- enable - Enable the plugin. Defaults to
true. - src - Favicon file path.
- target - Where we put the generated files. Defaults to
imgfolder. - html - Whether generate the html data in the
_datafolder for further usage. Defaults totrue. See an example. - opts - Extra favicons configurations. Defaults to
false - icons - Icons configurations.
Debug Mode
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 --debugTodo: Tests
