New assetsNotGzipped rule
This commit is contained in:
@@ -150,6 +150,11 @@
|
||||
<url-link url="offender" max-length="100"></url-link>
|
||||
</div>
|
||||
|
||||
<div ng-if="policyName === 'assetsNotGzipped'">
|
||||
<url-link url="offender.file" max-length="100"></url-link>
|
||||
({{offender.type}})
|
||||
</div>
|
||||
|
||||
<div ng-if="policyName === 'cachingTooShort'">
|
||||
<url-link url="offender.file" max-length="100"></url-link>
|
||||
cached for <b>{{offender.ttlWithUnit}} {{offender.unit}}</b>
|
||||
|
||||
@@ -1130,6 +1130,35 @@ var policies = {
|
||||
"isAbnormalThreshold": 1,
|
||||
"hasOffenders": true
|
||||
},
|
||||
"assetsNotGzipped": {
|
||||
"tool": "phantomas",
|
||||
"label": "Not gzipped",
|
||||
"message": "<p>This is the number of requests that should be compressed with gzip but aren't.</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": 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",
|
||||
@@ -1250,7 +1279,6 @@ var policies = {
|
||||
domain: parts[1],
|
||||
requests: parseInt(parts[2])
|
||||
};
|
||||
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
"label": "Network",
|
||||
"policies": {
|
||||
"notFound": 2,
|
||||
"assetsNotGzipped": 1.5,
|
||||
"closedConnections": 2,
|
||||
"multipleRequests": 2,
|
||||
"cachingNotSpecified": 1,
|
||||
|
||||
Reference in New Issue
Block a user