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`.
|
- **enable** - Enable the plugin. Defaults to `true`.
|
||||||
- **logger** - Verbose output. Defaults to `false`.
|
- **logger** - Verbose output. Defaults to `false`.
|
||||||
- **exclude** - Exclude files. Support wildcard pattern.
|
- **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({
|
hexo.config.neat_css = Object.assign({
|
||||||
enable: true,
|
enable: true,
|
||||||
logger: false,
|
logger: false,
|
||||||
|
level: 2,
|
||||||
exclude: ['*.min.css']
|
exclude: ['*.min.css']
|
||||||
}, hexo.config.neat_css)
|
}, hexo.config.neat_css)
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ function logicCss (str, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
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)
|
if (err) return reject(err)
|
||||||
let saved = ((str.length - result.styles.length) / str.length * 100).toFixed(2)
|
let saved = ((str.length - result.styles.length) / str.length * 100).toFixed(2)
|
||||||
resolve(result.styles)
|
resolve(result.styles)
|
||||||
|
|
Loading…
Reference in New Issue