Remove the Small Requests rule
This commit is contained in:
@@ -409,27 +409,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="policyName === 'smallRequests'">
|
||||
<div ng-repeat="(type, requests) in rule.offendersObj.list.byType" ng-if="requests.length > 0">
|
||||
<h3><ng-pluralize count="requests.length" when="{'0': 'small ' + type + ' file', 'one': '1 small ' + type + ' file', 'other': '{} small ' + type + ' files'}"></ng-pluralize></h3>
|
||||
<p ng-if="type == 'css' && requests.length > 0">Try to inline these styles in the head of the HTML or to merge them with other files.</p>
|
||||
<p ng-if="type == 'js' && requests.length > 0">Try to inline these scripts in the HTML or merge them with other files.</p>
|
||||
<p ng-if="type == 'image' && requests.length > 0">Try to inline these images (with base64 encoding for most image types except SVG that don't need base64 encoding). You can also create sprites.</p>
|
||||
<div class="table">
|
||||
<div class="headers">
|
||||
<div ng-if="type == 'image'">Preview</div>
|
||||
<div>File</div>
|
||||
<div>Weight (bytes)</div>
|
||||
</div>
|
||||
<div ng-repeat="request in requests track by $index">
|
||||
<div ng-if="type == 'image'"><img ng-src="{{request.url | https}}" class="smallPreview checker" /></div>
|
||||
<div><url-link url="request.url" max-length="100"></url-link></div>
|
||||
<div>{{request.size}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="policyName === 'cssBreakpoints'">
|
||||
<div ng-if="rule.value > 0">
|
||||
<h3>Breakpoints list</h3>
|
||||
|
||||
@@ -864,15 +864,6 @@ var policies = {
|
||||
"isAbnormalThreshold": 5,
|
||||
"hasOffenders": true
|
||||
},
|
||||
"smallRequests": {
|
||||
"tool": "redownload",
|
||||
"label": "Small requests",
|
||||
"message": "<p>List of all requests that are less than 2 KB. Try to merge them with other files.</p>",
|
||||
"isOkThreshold": 20,
|
||||
"isBadThreshold": 60,
|
||||
"isAbnormalThreshold": 90,
|
||||
"hasOffenders": true
|
||||
},
|
||||
"lazyLoadableImagesBelowTheFold": {
|
||||
"tool": "phantomas",
|
||||
"label": "Below the fold images",
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
"notFound": 3,
|
||||
"identicalFiles": 2,
|
||||
"emptyRequests": 3,
|
||||
"smallRequests": 0.5,
|
||||
"lazyLoadableImagesBelowTheFold": 2,
|
||||
"hiddenImages": 1
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ var Redownload = function() {
|
||||
offenders.emptyRequests = listEmptyRequests(results);
|
||||
metrics.emptyRequests = offenders.emptyRequests.length;
|
||||
|
||||
// Now remove unwanted responses (redirections and empty files)
|
||||
// Remove some more unwanted responses (redirections and empty files)
|
||||
results = results.filter(function(result) {
|
||||
return (/* (result.status < 300 || result.status >= 400) && */ result.weightCheck.bodySize > 0);
|
||||
});
|
||||
@@ -158,10 +158,6 @@ var Redownload = function() {
|
||||
offenders.compression = listFilesNotBrotlified(results);
|
||||
metrics.compression = offenders.compression.totalGain;
|
||||
|
||||
// Small requests
|
||||
offenders.smallRequests = listSmallRequests(results);
|
||||
metrics.smallRequests = offenders.smallRequests.total;
|
||||
|
||||
// Detect identical files
|
||||
offenders.identicalFiles = listIdenticalFiles(results);
|
||||
metrics.identicalFiles = offenders.identicalFiles.avoidableRequests;
|
||||
@@ -538,31 +534,6 @@ var Redownload = function() {
|
||||
return results;
|
||||
}
|
||||
|
||||
function listSmallRequests(requests) {
|
||||
var results = {
|
||||
total: 0,
|
||||
byType: {
|
||||
css: [],
|
||||
js: [],
|
||||
image: []
|
||||
}
|
||||
};
|
||||
|
||||
requests.forEach(function(req) {
|
||||
if (req.weightCheck.bodySize > 0 && req.weightCheck.bodySize < 2048) {
|
||||
if (req.isCSS || req.isJS || req.isImage) {
|
||||
results.byType[req.type].push({
|
||||
url: req.url,
|
||||
size: req.weightCheck.bodySize
|
||||
});
|
||||
results.total ++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function listIdenticalFiles(requests) {
|
||||
var hashes = {};
|
||||
var list = [];
|
||||
|
||||
@@ -108,12 +108,6 @@ describe('redownload', function() {
|
||||
data.toolsResults.redownload.offenders.totalRequests.byType.video.length.should.equal(0);
|
||||
data.toolsResults.redownload.offenders.totalRequests.byType.other.length.should.equal(1);
|
||||
|
||||
data.toolsResults.redownload.metrics.should.have.a.property('smallRequests').that.equals(0);
|
||||
data.toolsResults.redownload.offenders.should.have.a.property('smallRequests');
|
||||
data.toolsResults.redownload.offenders.smallRequests.byType.js.length.should.equal(0);
|
||||
data.toolsResults.redownload.offenders.smallRequests.byType.css.length.should.equal(0);
|
||||
data.toolsResults.redownload.offenders.smallRequests.byType.image.length.should.equal(0);
|
||||
|
||||
done();
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user