Prechádzať zdrojové kódy

New 'Small requests' category with smallJsFils, smallCssFiles and smallImages rules

Gaël Métais 10 rokov pred
rodič
commit
7c6676c981

+ 24 - 0
lib/metadata/policies.js

@@ -367,6 +367,30 @@ var policies = {
         "isBadThreshold": 20,
         "isAbnormalThreshold": 40
     },
+    "smallJsFiles": {
+        "tool": "phantomas",
+        "label": "Small JS files",
+        "message": "<p>Number of JS assets smaller than 2 KB that could probably be inlined or merged.</p>",
+        "isOkThreshold": 2,
+        "isBadThreshold": 10,
+        "isAbnormalThreshold": 16
+    },
+    "smallCssFiles": {
+        "tool": "phantomas",
+        "label": "Small CSS files",
+        "message": "<p>Number of CSS assets smaller than 2 KB that could probably be inlined or merged.</p>",
+        "isOkThreshold": 0,
+        "isBadThreshold": 8,
+        "isAbnormalThreshold": 12
+    },
+    "smallImages": {
+        "tool": "phantomas",
+        "label": "Small images",
+        "message": "<p>Images smaller than 2 KB that could be base64 encoded or merged into a sprite.</p>",
+        "isOkThreshold": 2,
+        "isBadThreshold": 17,
+        "isAbnormalThreshold": 30
+    },
     "notFound": {
         "tool": "phantomas",
         "label": "404 not found",

+ 9 - 0
lib/metadata/scoreProfileGeneric.json

@@ -80,6 +80,14 @@
                 "otherCount": 0
             }
         },
+        "smallRequests": {
+            "label": "Small requests",
+            "policies": {
+                "smallJsFiles": 1,
+                "smallCssFiles": 1,
+                "smallImages": 1
+            }
+        },
         "network": {
             "label": "Network",
             "policies": {
@@ -101,6 +109,7 @@
         "cssComplexity": 1,
         "badCSS": 1,
         "requests": 3,
+        "smallRequests": 1,
         "network": 2
     }
 }