* Adds an optional callback to minify method.
* Deprecates --selectors-merge-mode / selectorsMergeMode in favor to --compatibility / compatibility.
+* Fixes debug mode stats for stylesheets using `@import` statements.
* Skips empty removal if advanced processing is enabled.
* Fixed issue [#85](https://github.com/GoalSmashers/clean-css/issues/85) - resolving protocol `@import`s.
* Fixed issue [#160](https://github.com/GoalSmashers/clean-css/issues/160) - re-runs optimizer until a clean pass.
if (Buffer.isBuffer(data))
data = data.toString();
- if (options.debug) {
- this.startedAt = process.hrtime();
- this.stats.originalSize = data.length;
- }
-
if (options.processImport) {
// inline all imports
var self = this;
};
var minify = function(data, callback) {
+ var startedAt;
var stats = this.stats;
var options = this.options;
var context = this.context;
var freeTextProcessor = new FreeTextProcessor();
var urlsProcessor = new UrlsProcessor();
+ if (options.debug) {
+ this.startedAt = process.hrtime();
+ this.stats.originalSize = data.length;
+ }
+
var replace = function() {
if (typeof arguments[0] == 'function')
arguments[0]();
};
}
+ if (options.debug) {
+ startedAt = process.hrtime();
+ stats.originalSize = data.length;
+ }
+
replace(function escapeComments() {
data = commentsProcessor.escape(data);
});
data = data.trim();
if (options.debug) {
- var elapsed = process.hrtime(this.startedAt);
+ var elapsed = process.hrtime(startedAt);
stats.timeSpent = ~~(elapsed[0] * 1e3 + elapsed[1] / 1e6);
stats.efficiency = 1 - data.length / stats.originalSize;
stats.minifiedSize = data.length;
assert.include(stderr, path.join(process.cwd(), 'test/data/imports-min.css'));
},
}),
+ 'piped with correct debug info on inlining': pipedContext('@import url(test/data/imports.css);', '-d', {
+ 'should output correct info': function(error, stdout, stderr) {
+ assert.include(stderr, 'Original: 120 bytes');
+ assert.include(stderr, 'Minified: 86 bytes');
+ assert.include(stderr, 'Efficiency: 28.33%');
+ },
+ }),
'to output file with debug info': pipedContext('a{color: #f00;}', '-d -o debug.css', {
'should output nothing to stdout and debug info to stderr': function(error, stdout, stderr) {
assert.equal(stdout, '');