Why:
* 4.0 calculates stats by default but `process.hrtime` is not
available inside browsers. However, since we don't need
sub-ms resolution, `Date.now()` can be used instead.
* Fixed issue [#839](https://github.com/jakubpawlowicz/clean-css/issues/839) - allows URIs in import inlining rules.
* Fixed issue [#840](https://github.com/jakubpawlowicz/clean-css/issues/840) - allows input source map as map object.
* Fixed issue [#843](https://github.com/jakubpawlowicz/clean-css/issues/843) - regression in selector handling.
+* Fixed issue [#845](https://github.com/jakubpawlowicz/clean-css/issues/845) - web compatibility of 4.0 branch.
* Fixed issue [#847](https://github.com/jakubpawlowicz/clean-css/issues/847) - regression in handling invalid selectors.
[3.4.23 / 2016-12-17](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.22...v3.4.23)
efficiency: 0,
minifiedSize: 0,
originalSize: 0,
- startedAt: process.hrtime(),
+ startedAt: Date.now(),
timeSpent: 0
},
errors: [],
}
function calculateStatsFrom(styles, context) {
- var elapsed = process.hrtime(context.stats.startedAt);
+ var finishedAt = Date.now();
+ var timeSpent = finishedAt - context.stats.startedAt;
delete context.stats.startedAt;
- context.stats.timeSpent = ~~(elapsed[0] * 1e3 + elapsed[1] / 1e6);
+ context.stats.timeSpent = timeSpent;
context.stats.efficiency = 1 - styles.length / context.stats.originalSize;
context.stats.minifiedSize = styles.length;