mirror of https://github.com/curbengh/hexo-yam
feat: allow custom options for neat_css
https://github.com/jakubpawlowicz/clean-css
This commit is contained in:
parent
b93e92b1bb
commit
94a8f90c2b
|
@ -55,6 +55,9 @@ neat_css:
|
|||
- **enable** - Enable the plugin. Defaults to `true`.
|
||||
- **logger** - Verbose output. Defaults to `false`.
|
||||
- **exclude** - Exclude files. Support wildcard pattern.
|
||||
- **level** - Optimization level. Defaults to `2`.
|
||||
|
||||
For more options, see
|
||||
|
||||
----------
|
||||
|
||||
|
|
1
index.js
1
index.js
|
@ -19,6 +19,7 @@ if (hexo.config.neat_enable === true) {
|
|||
hexo.config.neat_css = Object.assign({
|
||||
enable: true,
|
||||
logger: false,
|
||||
level: 2,
|
||||
exclude: ['*.min.css']
|
||||
}, hexo.config.neat_css)
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ function logicCss (str, data) {
|
|||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
new CleanCSS({ level: 2 }).minify(str, function (err, result) {
|
||||
new CleanCSS(options).minify(str, function (err, result) {
|
||||
if (err) return reject(err)
|
||||
let saved = ((str.length - result.styles.length) / str.length * 100).toFixed(2)
|
||||
resolve(result.styles)
|
||||
|
|
Loading…
Reference in New Issue