Skip to content

Commit

Permalink
Added debug statements.
Browse files Browse the repository at this point in the history
  • Loading branch information
vseventer committed Jul 27, 2015
1 parent 6f29349 commit a086524
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## 0.2.0 (July 27, 2015)
* Added debug statements using [`debug`](https://github.com/visionmedia/debug).
* Renamed `enabled` option to `enable`.

## 0.1.0 (July 19, 2015)
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# more-css plugin for [Hexo](https://hexo.io)
> Compress CSS with [more-css](https://www.npmjs.com/package/more-css).
> Compress CSS with [more-css](https://github.com/army8735/more).
## Install
```bash
Expand All @@ -20,8 +20,11 @@ more_css:
- **exclude** - Exclude files.
- **radical** - Apply further minimization. Defaults to `true`.

## Debugging
Launch the node process like `DEBUG=hexo:more-css hexo ...` to inspect debug messages.

## Alternatives
- [hexo-clean-css](https://www.npmjs.com/package/hexo-clean-css)
- [hexo-clean-css](https://github.com/hexojs/hexo-clean-css)

See the [CSS minification benchmark](https://goalsmashers.github.io/css-minification-benchmark/) for a comparison of CSS compressors.

Expand Down
9 changes: 7 additions & 2 deletions lib/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
'use strict';

// Package modules.
var minimatch = require('minimatch'),
var debug = require('debug')('hexo:more-css'),
minimatch = require('minimatch'),
moreCss = require('more-css');

// Exports.
Expand All @@ -38,6 +39,7 @@ module.exports = function(str, locals) {

// Return original if disabled.
if(false === config.enable) {
debug('filter disabled'); // Debug.
return str;
}

Expand All @@ -52,7 +54,10 @@ module.exports = function(str, locals) {
return str;
}
}
debug('compressing %s', locals.path); // Debug.

// Return the result.
return moreCss.compress(str, config.radical);
var result = moreCss.compress(str, config.radical);
debug('updating %s, saved %d bytes', locals.path, str.length - result.length); // Debug.
return result;
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"test" : "./node_modules/.bin/mocha test/"
},
"dependencies": {
"debug" : "2.2.x",
"minimatch" : "2.0.x",
"more-css" : "0.12.x",
"object-assign" : "3.0.x"
Expand Down

0 comments on commit a086524

Please sign in to comment.