Fixes compression efficiency for stylesheets with @import statements.
authorGoalSmashers <jakub@goalsmashers.com>
Fri, 6 Sep 2013 07:31:52 +0000 (09:31 +0200)
committerGoalSmashers <jakub@goalsmashers.com>
Fri, 6 Sep 2013 07:31:52 +0000 (09:31 +0200)
bin/cleancss
lib/clean.js

index 4c90358..89521e4 100755 (executable)
@@ -105,7 +105,7 @@ function minify(data) {
     var taken = process.hrtime(start);
 
     console.error('Minification time: %dms', ~~(taken[0] * 1e3 + taken[1] / 1e6));
-    console.error('Compression efficiency: %d%', ~~((1 - minified.length / data.length) * 100));
+    console.error('Compression efficiency: %d%', ~~((1 - minified.length / CleanCSS.originalSize) * 100));
   } else {
     minified = CleanCSS.process(data, cleanOptions);
   }
index e8f1ff5..6e849c8 100644 (file)
@@ -73,6 +73,8 @@ var CleanCSS = {
       });
     }
 
+    this.originalSize = data.length;
+
     replace(function escapeComments() {
       data = commentsProcessor.escape(data);
     });