Replace TotalRequests and SmallRequests rules
This commit is contained in:
+12
-151
@@ -892,162 +892,23 @@ var policies = {
|
||||
"hasOffenders": true,
|
||||
"unit": 'bytes'
|
||||
},
|
||||
"requests": {
|
||||
"tool": "phantomas",
|
||||
"totalRequests": {
|
||||
"tool": "weightChecker",
|
||||
"label": "Total requests number",
|
||||
"message": "<p>This is one of the most important performance rule. Every request is slowing down the page loading.</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 or icon fonts</li><li>Base64 encode small images in HTML or stylesheets</li><li>Use lazyloading for images</li></ul></p>",
|
||||
"isOkThreshold": 15,
|
||||
"isBadThreshold": 100,
|
||||
"isAbnormalThreshold": 200,
|
||||
"hasOffenders": true,
|
||||
"takeOffendersFrom": ["htmlCount", "jsCount", "cssCount", "imageCount", "webfontCount", "videoCount", "jsonCount", "otherCount"],
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return {
|
||||
count: offenders.length,
|
||||
list: offenders
|
||||
.map(function(offender) {
|
||||
return offendersHelpers.fileWithSizePattern(offender);
|
||||
}).sort(function(a, b) {
|
||||
return (b.file < a.file) ? 1 : (b.file > a.file) ? -1 : 0;
|
||||
})
|
||||
};
|
||||
}
|
||||
"isAbnormalThreshold": 180,
|
||||
"hasOffenders": true
|
||||
},
|
||||
"htmlCount": {
|
||||
"tool": "phantomas",
|
||||
"label": "Document count",
|
||||
"message": "<p>The number of HTML pages requests, HTML fragments or iframes.</p>",
|
||||
"isOkThreshold": 10,
|
||||
"isBadThreshold": 20,
|
||||
"isAbnormalThreshold": 30,
|
||||
"hasOffenders": true,
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return {
|
||||
count: offenders.length,
|
||||
list: offenders.map(function(offender) {
|
||||
return offendersHelpers.fileWithSizePattern(offender);
|
||||
})
|
||||
};
|
||||
}
|
||||
},
|
||||
"jsCount": {
|
||||
"tool": "phantomas",
|
||||
"label": "Script count",
|
||||
"message": "<p>Reduce the number of scripts by concatenating them.</p>",
|
||||
"isOkThreshold": 5,
|
||||
"isBadThreshold": 15,
|
||||
"isAbnormalThreshold": 30,
|
||||
"hasOffenders": true,
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return {
|
||||
count: offenders.length,
|
||||
list: offenders.map(function(offender) {
|
||||
return offendersHelpers.fileWithSizePattern(offender);
|
||||
})
|
||||
};
|
||||
}
|
||||
},
|
||||
"cssCount": {
|
||||
"tool": "phantomas",
|
||||
"label": "CSS count",
|
||||
"message": "<p>Reduce the number of stylesheets by concatenating them.</p>",
|
||||
"isOkThreshold": 3,
|
||||
"isBadThreshold": 10,
|
||||
"isAbnormalThreshold": 22,
|
||||
"hasOffenders": true,
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return {
|
||||
count: offenders.length,
|
||||
list: offenders.map(function(offender) {
|
||||
return offendersHelpers.fileWithSizePattern(offender);
|
||||
})
|
||||
};
|
||||
}
|
||||
},
|
||||
"imageCount": {
|
||||
"tool": "phantomas",
|
||||
"label": "Image count",
|
||||
"message": "<p>Reduce the number of images by lazyloading them, by spriting them or by creating an icons font.</p>",
|
||||
"isOkThreshold": 15,
|
||||
"isBadThreshold": 40,
|
||||
"isAbnormalThreshold": 70,
|
||||
"hasOffenders": true,
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return {
|
||||
count: offenders.length,
|
||||
list: offenders.map(function(offender) {
|
||||
return offendersHelpers.fileWithSizePattern(offender);
|
||||
})
|
||||
};
|
||||
}
|
||||
},
|
||||
"webfontCount": {
|
||||
"tool": "phantomas",
|
||||
"label": "Font count",
|
||||
"message": "<p>Fonts are loaded on the critical path of the head. Load as few as possible.</p>",
|
||||
"isOkThreshold": 1,
|
||||
"isBadThreshold": 3,
|
||||
"isAbnormalThreshold": 5,
|
||||
"hasOffenders": true,
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return {
|
||||
count: offenders.length,
|
||||
list: offenders.map(function(offender) {
|
||||
return offendersHelpers.fileWithSizePattern(offender);
|
||||
})
|
||||
};
|
||||
}
|
||||
},
|
||||
"videoCount": {
|
||||
"tool": "phantomas",
|
||||
"label": "Video count",
|
||||
"message": "<p>The number of videos loaded.</p>",
|
||||
"isOkThreshold": 1,
|
||||
"isBadThreshold": 5,
|
||||
"isAbnormalThreshold": 15,
|
||||
"hasOffenders": true,
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return {
|
||||
count: offenders.length,
|
||||
list: offenders.map(function(offender) {
|
||||
return offendersHelpers.fileWithSizePattern(offender);
|
||||
})
|
||||
};
|
||||
}
|
||||
},
|
||||
"jsonCount": {
|
||||
"tool": "phantomas",
|
||||
"label": "JSON count",
|
||||
"message": "<p>The number of AJAX requests to JSON files or webservices.</p>",
|
||||
"isOkThreshold": 2,
|
||||
"isBadThreshold": 10,
|
||||
"isAbnormalThreshold": 25,
|
||||
"hasOffenders": true,
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return {
|
||||
count: offenders.length,
|
||||
list: offenders.map(function(offender) {
|
||||
return offendersHelpers.fileWithSizePattern(offender);
|
||||
})
|
||||
};
|
||||
}
|
||||
},
|
||||
"otherCount": {
|
||||
"tool": "phantomas",
|
||||
"label": "Other types of requests",
|
||||
"message": "<p>They can be Flash, XML, music or any unknown format.</p>",
|
||||
"isOkThreshold": 5,
|
||||
"isBadThreshold": 20,
|
||||
"isAbnormalThreshold": 40,
|
||||
"hasOffenders": true,
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return {
|
||||
count: offenders.length,
|
||||
list: offenders.map(function(offender) {
|
||||
return offendersHelpers.fileWithSizePattern(offender);
|
||||
})
|
||||
};
|
||||
}
|
||||
"smallRequests": {
|
||||
"tool": "weightChecker",
|
||||
"label": "Small requests",
|
||||
"message": "<p>List of all requests that are less than 2 KB. Try to merge them with other files.</p>",
|
||||
"isOkThreshold": 4,
|
||||
"isBadThreshold": 30,
|
||||
"isAbnormalThreshold": 50,
|
||||
"hasOffenders": true
|
||||
},
|
||||
"smallJsFiles": {
|
||||
"tool": "phantomas",
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
"requests": {
|
||||
"label": "Requests",
|
||||
"policies": {
|
||||
"requests": 5,
|
||||
"totalRequests": 5,
|
||||
"domains": 3,
|
||||
"notFound": 3,
|
||||
"multipleRequests": 2,
|
||||
|
||||
Reference in New Issue
Block a user