|
@@ -54,7 +54,7 @@ var policies = {
|
|
|
"isBadThreshold": 2000,
|
|
|
"isAbnormalThreshold": 4000,
|
|
|
"hasOffenders": false,
|
|
|
- "unit": 'ms'
|
|
|
+ "unit": "ms"
|
|
|
},
|
|
|
"DOMaccesses": {
|
|
|
"tool": "domAccessAgregator",
|
|
@@ -734,22 +734,96 @@ var policies = {
|
|
|
"isBadThreshold": 3145728,
|
|
|
"isAbnormalThreshold": 5242880,
|
|
|
"hasOffenders": true,
|
|
|
- "unit": 'bytes'
|
|
|
+ "unit": "bytes"
|
|
|
},
|
|
|
- "imageOptimization": {
|
|
|
- "tool": "redownload",
|
|
|
+ "imagesNotOptimized": {
|
|
|
+ "tool": "phantomas",
|
|
|
"label": "Image optimization",
|
|
|
- "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>",
|
|
|
- "isOkThreshold": 20480,
|
|
|
+ "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, so you might be able to compress even more!</p>",
|
|
|
+ "isOkThreshold": 2048,
|
|
|
"isBadThreshold": 204800,
|
|
|
"isAbnormalThreshold": 307200,
|
|
|
"hasOffenders": true,
|
|
|
- "unit": 'bytes'
|
|
|
+ "unit": "bytes",
|
|
|
+ "valueTransformFn": function(offenders) {
|
|
|
+ let totalGain = 0;
|
|
|
+ offenders.forEach((offender) => {
|
|
|
+ offender.gain = offender.fileSize - offender.newFileSize;
|
|
|
+ totalGain += offender.gain;
|
|
|
+ });
|
|
|
+ return totalGain;
|
|
|
+ },
|
|
|
+ "offendersTransformFn": function(offenders) {
|
|
|
+ return offenders;
|
|
|
+ }
|
|
|
},
|
|
|
- "imagesTooLarge": {
|
|
|
- "tool": "redownload",
|
|
|
+ "imagesOldFormat": {
|
|
|
+ "tool": "phantomas",
|
|
|
+ "label": "Old image formats",
|
|
|
+ "message": "<p>This metric goes further than \"Image optimization\". Measures the number of bytes that could be saved by converting images to newer and more efficient formats. The best image format is generally AVIF and the second best is WebP.</p><p>Be careful, you need to provide fallback images for old browsers and search engine bots.</p>",
|
|
|
+ "isOkThreshold": 2048,
|
|
|
+ "isBadThreshold": 512000,
|
|
|
+ "isAbnormalThreshold": 819200,
|
|
|
+ "hasOffenders": true,
|
|
|
+ "unit": "bytes",
|
|
|
+ "valueTransformFn": function(offenders) {
|
|
|
+ let totalGain = 0;
|
|
|
+ offenders.forEach((offender) => {
|
|
|
+ offender.gain = offender.fileSize - offender.newFileSize;
|
|
|
+ totalGain += offender.gain;
|
|
|
+ });
|
|
|
+ return totalGain;
|
|
|
+ },
|
|
|
+ "offendersTransformFn": function(offenders) {
|
|
|
+ return offenders;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "imagesScaledDown": {
|
|
|
+ "tool": "phantomas",
|
|
|
"label": "Oversized images",
|
|
|
- "message": "<p>This is the number of images with a width >1200px on mobile, >1800px on tablet, >2400 on desktop, >3200px on HD desktop. Try reducing their size.</p><p>Please ignore if the file is used as a sprite.</p>",
|
|
|
+ "message": "<p>This rule compares the number of pixels in a loaded images to the number of physical pixels it is displayed on. Then it estimates the number of KB that could be saved by serving it with the correct dimensions.</p><p>Of course, it is hard to serve perfect images for all screens. For this reason, this rule is quite permissive.</p>",
|
|
|
+ "isOkThreshold": 2048,
|
|
|
+ "isBadThreshold": 307200,
|
|
|
+ "isAbnormalThreshold": 512000,
|
|
|
+ "hasOffenders": true,
|
|
|
+ "unit": "bytes",
|
|
|
+ "valueTransformFn": function(offenders) {
|
|
|
+ let totalGain = 0;
|
|
|
+ offenders.forEach((offender) => {
|
|
|
+ offender.gain = offender.fileSize - offender.newFileSize;
|
|
|
+ totalGain += offender.gain;
|
|
|
+ });
|
|
|
+ return totalGain;
|
|
|
+ },
|
|
|
+ "offendersTransformFn": function(offenders) {
|
|
|
+ return offenders;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "imagesExcessiveDensity": {
|
|
|
+ "tool": "phantomas",
|
|
|
+ "label": "Excessive image density",
|
|
|
+ "message": "<p>This metric measures the number of bytes that could be saved by going further than just resizing images.<p>Devices with very high pixel density screen (such as 3x or 4x) are programmed to load high density images. This is the normal behavior, however the human eye barely sees the difference over 2x. This metric alerts you if an image density is > 2.2x.</p><p>There is currently no browser functionnality to prevent the issue (for this reason its impact on global score is low). But you can build your own clever solution!</p>",
|
|
|
+ "isOkThreshold": 102400,
|
|
|
+ "isBadThreshold": 307200,
|
|
|
+ "isAbnormalThreshold": 512000,
|
|
|
+ "hasOffenders": true,
|
|
|
+ "unit": "bytes",
|
|
|
+ "valueTransformFn": function(offenders) {
|
|
|
+ let totalGain = 0;
|
|
|
+ offenders.forEach((offender) => {
|
|
|
+ offender.gain = offender.fileSize - offender.newFileSize;
|
|
|
+ totalGain += offender.gain;
|
|
|
+ });
|
|
|
+ return totalGain;
|
|
|
+ },
|
|
|
+ "offendersTransformFn": function(offenders) {
|
|
|
+ return offenders;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "imagesWithIncorrectSizesParam": {
|
|
|
+ "tool": "phantomas",
|
|
|
+ "label": "Incorrect sizes parameter",
|
|
|
+ "message": "<p>When using an adaptative image with a <i>srcset</i> attribute and <i>w</i> values, it is important to correctly set the <i>sizes</i> attribute. Otherwise, the browser might pick the wrong image in the <i>srcset</i>.</p><p>The <a href=\”https://chrome.google.com/webstore/detail/responsive-image-linter/mnddginionlghpblkimpdalcecpnbjln\" target=\"_blank\">Responsive Image Linter</a> extension for Chrome can help you further.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
"isBadThreshold": 5,
|
|
|
"isAbnormalThreshold": 10,
|
|
@@ -763,7 +837,7 @@ var policies = {
|
|
|
"isBadThreshold": 204800,
|
|
|
"isAbnormalThreshold": 409600,
|
|
|
"hasOffenders": true,
|
|
|
- "unit": 'bytes'
|
|
|
+ "unit": "bytes"
|
|
|
},
|
|
|
"fileMinification": {
|
|
|
"tool": "redownload",
|
|
@@ -773,12 +847,12 @@ var policies = {
|
|
|
"isBadThreshold": 61440,
|
|
|
"isAbnormalThreshold": 122880,
|
|
|
"hasOffenders": true,
|
|
|
- "unit": 'bytes'
|
|
|
+ "unit": "bytes"
|
|
|
},
|
|
|
"totalRequests": {
|
|
|
"tool": "redownload",
|
|
|
"label": "Requests number",
|
|
|
- "message": "<p>Each request slows down the page loading, especially on the protocol HTTP/1, but also a little on HTTP/2.</p><p>There are several technics to reduce their number:<ul><li>Concatenate JS files</li><li>Concatenate CSS files</li><li>Embed or inline small JS or CSS files in the HTML</li><li>Create sprites</li><li>Base64 encode small images in HTML or stylesheets</li><li>Use lazyloading for images</li></ul></p>",
|
|
|
+ "message": "<p>Each request slows down the page loading, especially on the protocol HTTP/1, but also a little on HTTP/2 or 3.</p><p>There are several technics to reduce their number:<ul><li>Concatenate JS files</li><li>Concatenate CSS files</li><li>Embed or inline small JS or CSS files in the HTML</li><li>Create sprites</li><li>Base64 encode small images in HTML or stylesheets</li><li>Use lazyloading for images</li></ul></p>",
|
|
|
"isOkThreshold": 80,
|
|
|
"isBadThreshold": 240,
|
|
|
"isAbnormalThreshold": 320,
|
|
@@ -869,7 +943,7 @@ var policies = {
|
|
|
"isOkThreshold": 0,
|
|
|
"isBadThreshold": 102400,
|
|
|
"isAbnormalThreshold": 204800,
|
|
|
- "unit": 'bytes',
|
|
|
+ "unit": "bytes",
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
return offenders;
|
|
@@ -895,7 +969,7 @@ var policies = {
|
|
|
"isBadThreshold": 51200,
|
|
|
"isAbnormalThreshold": 122880,
|
|
|
"hasOffenders": true,
|
|
|
- "unit": 'bytes'
|
|
|
+ "unit": "bytes"
|
|
|
},
|
|
|
"oldHttpProtocol": {
|
|
|
"label": "HTTP protocols",
|