Skip to content

Commit

Permalink
feat: allow custom options for neat_css
Browse files Browse the repository at this point in the history
  • Loading branch information
weyusi committed Apr 23, 2019
1 parent b93e92b commit 94a8f90
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

----------

Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion lib/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 94a8f90

Please sign in to comment.