|
@@ -267,7 +267,7 @@ var policies = {
|
|
|
},
|
|
|
"jQueryVersion": {
|
|
|
"label": "jQuery version",
|
|
|
- "message": "<p>Current latest versions of jQuery are 1.11 (with support for old IE versions) and 2.1 (without).</p><p>Each new version of jQuery optimizes performances. Do not keep an old version of jQuery. Updating can sometimes break a few things, but it is generally quite easy to fix them up. So don't hesitate.</p>",
|
|
|
+ "message": "<p>Current latest versions of jQuery are 1.12 (with support for old IE versions) and 2.2 (without).</p><p>Each new version of jQuery optimizes performances. Do not keep an old version of jQuery. Updating can sometimes break a few things, but it is generally quite easy to fix them up. So don't hesitate.</p>",
|
|
|
"hasOffenders": false,
|
|
|
"scoreFn": function(data) {
|
|
|
var differentVersions = data.toolsResults.phantomas.metrics.jQueryVersionsLoaded;
|
|
@@ -279,27 +279,31 @@ var policies = {
|
|
|
var value = data.toolsResults.phantomas.metrics.jQueryVersion;
|
|
|
var score;
|
|
|
|
|
|
- if (value.indexOf('1.11.') === 0 ||
|
|
|
- value.indexOf('1.12.') === 0 ||
|
|
|
- value.indexOf('2.1.') === 0 ||
|
|
|
+ if (value.indexOf('1.12.') === 0 ||
|
|
|
value.indexOf('2.2.') === 0 ||
|
|
|
- value.indexOf('3.0.') === 0) {
|
|
|
+ value.indexOf('1.13.') === 0 ||
|
|
|
+ value.indexOf('2.3.') === 0 ||
|
|
|
+ value.indexOf('3.0.') === 0 ||
|
|
|
+ value.indexOf('3.1.') === 0) {
|
|
|
score = 100;
|
|
|
+ } else if (value.indexOf('1.11.') === 0 ||
|
|
|
+ value.indexOf('2.1.') === 0) {
|
|
|
+ score = 90;
|
|
|
} else if (value.indexOf('1.10.') === 0 ||
|
|
|
value.indexOf('2.0.') === 0) {
|
|
|
- score = 90;
|
|
|
- } else if (value.indexOf('1.9.') === 0) {
|
|
|
score = 70;
|
|
|
- } else if (value.indexOf('1.8.') === 0) {
|
|
|
+ } else if (value.indexOf('1.9.') === 0) {
|
|
|
score = 50;
|
|
|
- } else if (value.indexOf('1.7') === 0) {
|
|
|
+ } else if (value.indexOf('1.8.') === 0) {
|
|
|
score = 40;
|
|
|
- } else if (value.indexOf('1.6') === 0) {
|
|
|
+ } else if (value.indexOf('1.7') === 0) {
|
|
|
score = 30;
|
|
|
- } else if (value.indexOf('1.5') === 0) {
|
|
|
+ } else if (value.indexOf('1.6') === 0) {
|
|
|
score = 20;
|
|
|
- } else if (value.indexOf('1.4') === 0) {
|
|
|
+ } else if (value.indexOf('1.5') === 0) {
|
|
|
score = 10;
|
|
|
+ } else if (value.indexOf('1.4') === 0) {
|
|
|
+ score = 0;
|
|
|
} else if (value.indexOf('1.3') === 0) {
|
|
|
score = 0;
|
|
|
} else if (value.indexOf('1.2') === 0) {
|
|
@@ -420,7 +424,40 @@ var policies = {
|
|
|
"isOkThreshold": 750,
|
|
|
"isBadThreshold": 3000,
|
|
|
"isAbnormalThreshold": 4500,
|
|
|
- "hasOffenders": false
|
|
|
+ "hasOffenders": true,
|
|
|
+ "offendersTransformFn": function(offenders) {
|
|
|
+ var hasInline = false;
|
|
|
+ var inlineCount = 0;
|
|
|
+ var files = [];
|
|
|
+
|
|
|
+ offenders.forEach(function(line) {
|
|
|
+ if (line.indexOf('[inline CSS]: ') === 0) {
|
|
|
+ hasInline = true;
|
|
|
+ inlineCount += parseInt(line.substr(14));
|
|
|
+ } else {
|
|
|
+ var parts = /^<(.*)>: (\d+)$/.exec(line);
|
|
|
+
|
|
|
+ if (parts) {
|
|
|
+ files.push({
|
|
|
+ file: parts[1],
|
|
|
+ rules: parseInt(parts[2], 10)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (hasInline) {
|
|
|
+ files.push({
|
|
|
+ file: 'inline CSS',
|
|
|
+ rules: inlineCount
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ count: files.length,
|
|
|
+ list: files
|
|
|
+ };
|
|
|
+ }
|
|
|
},
|
|
|
"cssComplexSelectors": {
|
|
|
"tool": "phantomas",
|
|
@@ -925,7 +962,7 @@ var policies = {
|
|
|
"imageOptimization": {
|
|
|
"tool": "weightChecker",
|
|
|
"label": "Image optimization",
|
|
|
- "message": "<p>This metric mesures the number of bytes that could be saved by optimizing images.</p><p>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 <a href=\"https://kraken.io/\" target=\"_blank\">Kraken.io</a> or the excellent <a href=\"https://imageoptim.com/\" target=\"_blank\">ImageOptim</a> on Mac. For SVG images, you can use <a href=\"https://jakearchibald.github.io/svgomg/\" target=\"_blank\">SVGOMG</a></p><p>The tools in use in YellowLabTools are not set to their maximum optimization power (JPEG quality 85), so you might be able to compress even more!</p><p>Please note that Yellow Lab Tools' engine (PhantomJS) is not compatible with image srcset (unless you use a polyfill). This can lead to incorrect page weight.</p>",
|
|
|
+ "message": "<p>This metric measures the number of bytes that could be saved by optimizing images.</p><p>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 <a href=\"https://kraken.io/\" target=\"_blank\">Kraken.io</a> or the excellent <a href=\"https://imageoptim.com/\" target=\"_blank\">ImageOptim</a> on Mac. For SVG images, you can use <a href=\"https://jakearchibald.github.io/svgomg/\" target=\"_blank\">SVGOMG</a></p><p>The tools in use in YellowLabTools are not set to their maximum optimization power (JPEG quality 85), so you might be able to compress even more!</p><p>Please note that Yellow Lab Tools' engine (PhantomJS) is not compatible with image srcset (unless you use a polyfill). This can lead to incorrect page weight.</p>",
|
|
|
"isOkThreshold": 10240,
|
|
|
"isBadThreshold": 122880,
|
|
|
"isAbnormalThreshold": 307200,
|
|
@@ -935,7 +972,7 @@ var policies = {
|
|
|
"gzipCompression": {
|
|
|
"tool": "weightChecker",
|
|
|
"label": "Gzip compression",
|
|
|
- "message": "<p>Mesures the number of bytes that could be saved by compressing file transfers.</p><p>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. <a href=\"https://gist.github.com/gmetais/971ce13a1fbeebd88445\" target=\"_blank\">Here</a> is a list of Content-Types that should be gzipped.</p>",
|
|
|
+ "message": "<p>Measures the number of bytes that could be saved by compressing file transfers.</p><p>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. <a href=\"https://gist.github.com/gmetais/971ce13a1fbeebd88445\" target=\"_blank\">Here</a> is a list of Content-Types that should be gzipped.</p>",
|
|
|
"isOkThreshold": 5125,
|
|
|
"isBadThreshold": 81920,
|
|
|
"isAbnormalThreshold": 153600,
|
|
@@ -1044,6 +1081,35 @@ var policies = {
|
|
|
"isAbnormalThreshold": 30,
|
|
|
"hasOffenders": true
|
|
|
},
|
|
|
+ "http2": {
|
|
|
+ "label": "HTTP/2 or SPDY",
|
|
|
+ "message": "<p>HTTP/2 is the latest version of the HTTP protocol and is designed to optimize load speed. SPDY is deprecated but still very well supported.</p><p>The latest versions of all major browsers are now compatible. The difficulty is on the server side, where technologies are not quite ready yet.</p>",
|
|
|
+ "hasOffenders": true,
|
|
|
+ "scoreFn": function(data) {
|
|
|
+ if (!data.toolsResults.http2) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ var isHttp2 = data.toolsResults.http2.metrics.http2;
|
|
|
+
|
|
|
+ var result = {
|
|
|
+ value: isHttp2 ? 'Yes' : 'No',
|
|
|
+ score: isHttp2 ? 100 : 0,
|
|
|
+ bad: !isHttp2,
|
|
|
+ abnormal: false,
|
|
|
+ abnormalityScore: 0
|
|
|
+ };
|
|
|
+
|
|
|
+ if (data.toolsResults.http2.offenders) {
|
|
|
+ result.offendersObj = {
|
|
|
+ count: data.toolsResults.http2.offenders.http2.length,
|
|
|
+ list: data.toolsResults.http2.offenders.http2
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ },
|
|
|
"cachingDisabled": {
|
|
|
"tool": "phantomas",
|
|
|
"label": "Caching disabled",
|