Fix bug with SVG minification+compression

This commit is contained in:
Gaël Métais
2015-06-18 23:06:57 +02:00
parent 113665139a
commit d4815e855e
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ var GzipCompressor = function() {
var compressedSize = buffer.length;
if (gainIsEnough(uncompressedSize, compressedSize)) {
debug('Minified file correctly gziped, was %d and is now %d bytes', uncompressedSize, compressedSize);
debug('Correctly gziped the minified file, was %d and is now %d bytes', uncompressedSize, compressedSize);
entry.weightCheck.afterOptimizationAndCompression = compressedSize;
} else {
+1 -1
View File
@@ -129,7 +129,7 @@ var ImageOptimizer = function() {
debug('SVG lossless compression complete for %s', entry.url);
if (gainIsEnough(fileSize, newFileSize)) {
entry.weightCheck.bodyAfterOptimization = newFile;
entry.weightCheck.bodyAfterOptimization = newFile.contents.toString();
entry.weightCheck.lossless = entry.weightCheck.optimized = newFileSize;
entry.weightCheck.isOptimized = false;
debug('Filesize is %d bytes smaller (-%d%)', fileSize - newFileSize, Math.round((fileSize - newFileSize) * 100 / fileSize));
+2 -2
View File
@@ -51,7 +51,7 @@ describe('fileMinifier', function() {
.then(function(newEntry) {
newEntry.weightCheck.should.have.a.property('isOptimized').that.equals(false);
newEntry.weightCheck.should.have.a.property('optimized').that.is.below(fileSize);
newEntry.weightCheck.should.have.a.property('bodyAfterOptimization');
newEntry.weightCheck.should.have.a.property('bodyAfterOptimization').that.is.a('string');
done();
})
@@ -193,7 +193,7 @@ describe('fileMinifier', function() {
.then(function(newEntry) {
newEntry.weightCheck.should.have.a.property('isOptimized').that.equals(false);
newEntry.weightCheck.should.have.a.property('optimized').that.is.below(fileSize);
newEntry.weightCheck.should.have.a.property('bodyAfterOptimization');
newEntry.weightCheck.should.have.a.property('bodyAfterOptimization').that.is.a('string');
done();
})
+1 -1
View File
@@ -208,7 +208,7 @@ describe('imageOptimizer', function() {
newEntry.weightCheck.should.have.a.property('isOptimized').that.equals(false);
newEntry.weightCheck.should.have.a.property('lossless').that.is.below(fileSize);
newEntry.weightCheck.should.have.a.property('optimized').that.equals(newEntry.weightCheck.lossless);
newEntry.weightCheck.should.have.a.property('bodyAfterOptimization');
newEntry.weightCheck.should.have.a.property('bodyAfterOptimization').that.is.a('string');
done();
})