diff --git a/front/src/views/rule.html b/front/src/views/rule.html index ded0da4..e8df0cd 100644 --- a/front/src/views/rule.html +++ b/front/src/views/rule.html @@ -225,6 +225,26 @@ +
+

{{rule.value | bytes}} could be saved on

+
+
+
File
+
Current weight
+
Gzipped
+
Gain
+
+
+
+ +
+
{{file.original | bytes}}
+
{{file.gzipped | bytes}}
+
-{{file.gain | bytes}}
+
+
+
+

{{rule.value | bytes}} could be saved on

diff --git a/lib/metadata/policies.js b/lib/metadata/policies.js index eda9cc2..b785c47 100644 --- a/lib/metadata/policies.js +++ b/lib/metadata/policies.js @@ -866,9 +866,9 @@ var policies = { "tool": "weightChecker", "label": "Image optimization", "message": "

This metric mesures the number of bytes that could be saved by optimizing images.

Image optimization is generally one of the easiest way to reduce a page weight, and as a result, the page load time. Don't use Photoshop or other image editing tools, they're not very good for optimization. Use specialized tools such as Kraken.io or the excellent ImageOption on Mac. For SVG images, you can use SVGOMG

The tools in use in YellowLabTools are not set to their maximum optimization power, so you might be able to compress even more!

", - "isOkThreshold": 30720, + "isOkThreshold": 10240, "isBadThreshold": 122880, - "isAbnormalThreshold": 409600, + "isAbnormalThreshold": 307200, "hasOffenders": true, "unit": 'bytes' }, @@ -876,7 +876,7 @@ var policies = { "tool": "weightChecker", "label": "Gzip compression", "message": "

Mesures the number of bytes that could be saved by compressing file transfers.

Gzip is a powerfull weight reducer and should be enabled on text-based assets in your server's configuration. Note that gzipping small files (< 1 KB) is arguable, and that some assets such as images should not be gzipped as they are already compressed. Here is a list of Content-Types that should be gzipped.

", - "isOkThreshold": 20480, + "isOkThreshold": 5125, "isBadThreshold": 81920, "isAbnormalThreshold": 153600, "hasOffenders": true, @@ -886,8 +886,8 @@ var policies = { "tool": "weightChecker", "label": "File minification", "message": "

This is the weight that could be saved if all text resources were correctly minified.

The tools in use here are UglifyJS, clean-css and HTMLMinifier. These tools are so good that some of your minified files can be marked as unminified. Change your tool it this happens :)

The gains of minification are generally small, but the impact can be high when these text files are loaded on the critical path.

", - "isOkThreshold": 10240, - "isBadThreshold": 76800, + "isOkThreshold": 5125, + "isBadThreshold": 61440, "isAbnormalThreshold": 122880, "hasOffenders": true, "unit": 'bytes' diff --git a/lib/tools/weightChecker/fileMinifier.js b/lib/tools/weightChecker/fileMinifier.js index 8e5124a..4f87476 100644 --- a/lib/tools/weightChecker/fileMinifier.js +++ b/lib/tools/weightChecker/fileMinifier.js @@ -121,7 +121,7 @@ var FileMinifier = function() { }); } else { - debug('File type %s is not an (optimizable) image', entry.contentType); + debug('Not minfiable type or already minified'); deferred.resolve(entry); } diff --git a/lib/tools/weightChecker/gzipCompressor.js b/lib/tools/weightChecker/gzipCompressor.js index 9981391..795cb47 100644 --- a/lib/tools/weightChecker/gzipCompressor.js +++ b/lib/tools/weightChecker/gzipCompressor.js @@ -41,6 +41,7 @@ var GzipCompressor = function() { } }); } else { + deferred.resolve(entry); } diff --git a/lib/tools/weightChecker/imageOptimizer.js b/lib/tools/weightChecker/imageOptimizer.js index a0b90d5..fcff06a 100644 --- a/lib/tools/weightChecker/imageOptimizer.js +++ b/lib/tools/weightChecker/imageOptimizer.js @@ -143,7 +143,7 @@ var ImageOptimizer = function() { }); } else { - debug('File type %s is not an (optimizable) image', entry.contentType); + debug('File type %s is not an optimizable image', entry.contentType); deferred.resolve(entry); } @@ -167,7 +167,7 @@ var ImageOptimizer = function() { } function isSVG(entry) { - return entry.isImage && entry.contentType === 'image/svg+xml'; + return entry.isImage && entry.isSVG; } function compressJpegLosslessly(imageBody) {