diff --git a/front/src/views/rule.html b/front/src/views/rule.html index 7e3d15a..ded0da4 100644 --- a/front/src/views/rule.html +++ b/front/src/views/rule.html @@ -146,11 +146,6 @@ -
- - ({{offender.type}}) -
-
cached for {{offender.ttlWithUnit}} {{offender.unit}} @@ -241,10 +236,12 @@
- +
-
{{file.original | bytes}}
-
{{file.minified | bytes}}
+
{{file.original | bytes}} (gzipped)
+
{{file.original | bytes}} ({{file.afterCompression | bytes}} gzipped)
+
{{file.afterOptimizationAndCompression | bytes}} (gzipped)
+
{{file.optimized | bytes}} ({{file.afterOptimizationAndCompression | bytes}} gzipped)
-{{file.gain | bytes}}
diff --git a/lib/metadata/policies.js b/lib/metadata/policies.js index 3354348..eda9cc2 100644 --- a/lib/metadata/policies.js +++ b/lib/metadata/policies.js @@ -872,13 +872,23 @@ var policies = { "hasOffenders": true, "unit": 'bytes' }, + "gzipCompression": { + "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, + "isBadThreshold": 81920, + "isAbnormalThreshold": 153600, + "hasOffenders": true, + "unit": 'bytes' + }, "fileMinification": { "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": 20480, - "isBadThreshold": 81920, - "isAbnormalThreshold": 153600, + "isOkThreshold": 10240, + "isBadThreshold": 76800, + "isAbnormalThreshold": 122880, "hasOffenders": true, "unit": 'bytes' }, @@ -1099,35 +1109,6 @@ var policies = { "isAbnormalThreshold": 1, "hasOffenders": true }, - "assetsNotGzipped": { - "tool": "phantomas", - "label": "Not gzipped", - "message": "

This is the number of requests that should be compressed with gzip but aren't.

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": 0, - "isBadThreshold": 12, - "isAbnormalThreshold": 20, - "hasOffenders": true, - "offendersTransformFn": function(offenders) { - return { - count: offenders.length, - list: offenders.map(function(offender) { - var parts = /^([^ ]*) \((.+)\)$/.exec(offender); - - if (!parts) { - debug('assetsNotGzipped offenders transform function error with "%s"', offender); - return { - parseError: offender - }; - } - - return { - file: parts[1], - type: parts[2] - }; - }) - }; - } - }, "closedConnections": { "tool": "phantomas", "label": "Connections closed", diff --git a/lib/metadata/scoreProfileGeneric.json b/lib/metadata/scoreProfileGeneric.json index 1407255..277b06d 100644 --- a/lib/metadata/scoreProfileGeneric.json +++ b/lib/metadata/scoreProfileGeneric.json @@ -74,8 +74,8 @@ "policies": { "totalWeight": 5, "imageOptimization": 2, - "fileMinification": 1, - "assetsNotGzipped": 2 + "gzipCompression": 2, + "fileMinification": 1 } }, "requests": {