Skip to content

Commit ff3519d

Browse files
committed
docs(cli): add viewport, verbose, workflow options and snippet aliases table
1 parent 0efcd89 commit ff3519d

1 file changed

Lines changed: 54 additions & 11 deletions

File tree

pages/CLI.mdx

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,73 @@ JSON output (for piping into `jq` or CI scripts):
4343
npx webperf-snippets https://web.dev --json
4444
```
4545

46-
Run a single snippet:
46+
Run a single snippet by alias:
4747

4848
```bash copy
4949
npx webperf-snippets https://web.dev --snippet LCP-Subparts
50+
npx webperf-snippets https://web.dev --snippet render-blocking
51+
npx webperf-snippets https://web.dev --snippet fonts
5052
```
5153

54+
### Snippet aliases
55+
56+
| Alias | Snippet | Category |
57+
| ----- | ------- | -------- |
58+
| `LCP` | Largest Contentful Paint | Core Web Vitals |
59+
| `CLS` | Cumulative Layout Shift | Core Web Vitals |
60+
| `LCP-Subparts` | LCP Subparts breakdown | Core Web Vitals |
61+
| `fonts` | Fonts Preloaded, Loaded, and Used Above The Fold | Loading |
62+
| `render-blocking` | Find render-blocking resources | Loading |
63+
| `resource-hints` | Resource Hints Validation | Loading |
64+
| `preload-scripts` | Validate Preload / Async / Defer Scripts | Loading |
65+
| `priority-hints` | Priority Hints Audit | Loading |
66+
| `critical-css` | Critical CSS Detection | Loading |
67+
| `ttfb` | TTFB Sub-Parts | Loading |
68+
| `script-parties` | First and Third-Party Script Info | Loading |
69+
| `script-loading` | Script Loading | Loading |
70+
| `lazy-atf` | Above-the-fold lazy-loaded images | Loading |
71+
| `lazy-conflict` | Images with `lazy` + `fetchpriority` conflict | Loading |
72+
| `eager-below-fold` | Non-lazy images outside viewport | Loading |
73+
5274
Gate CI on performance budgets:
5375

5476
```bash copy
5577
npx webperf-snippets https://web.dev --budget-lcp 2500 --budget-cls 0.1
5678
```
5779

80+
Run the structural audit workflow:
81+
82+
```bash copy
83+
npx webperf-snippets https://web.dev --workflow audit
84+
```
85+
86+
Simulate a mobile viewport (default) or switch to desktop:
87+
88+
```bash copy
89+
npx webperf-snippets https://web.dev --viewport mobile
90+
npx webperf-snippets https://web.dev --viewport desktop
91+
```
92+
93+
Show all items, including passing checks:
94+
95+
```bash copy
96+
npx webperf-snippets https://web.dev --verbose
97+
```
98+
5899
### Options
59100

60-
| Option | Description |
61-
| ---------------------- | ----------------------------------------------------------- |
62-
| `--workflow <name>` | Workflow to run. Default: `core-web-vitals`. |
63-
| `--snippet <name>` | Run a single snippet (`LCP`, `CLS`, or `Category/Name`). |
64-
| `--json` | Output JSON instead of formatted text. |
65-
| `--wait <ms>` | Post-load wait before evaluating snippets. Default: `3000`. |
66-
| `--budget-lcp <ms>` | Exit `1` if LCP exceeds this value. |
67-
| `--budget-cls <score>` | Exit `1` if CLS exceeds this value. |
68-
| `--headed` | Show the browser window (debug). |
69-
| `-h, --help` | Show help. |
101+
| Option | Description |
102+
| ----------------------- | ------------------------------------------------------------------------------------ |
103+
| `--workflow <name>` | Workflow to run. Default: `core-web-vitals`. Options: `core-web-vitals`, `audit`. |
104+
| `--snippet <name>` | Run a single snippet by alias or `Category/Name` path. |
105+
| `--json` | Output JSON instead of formatted text. |
106+
| `--viewport <preset>` | Viewport preset. Default: `mobile`. Options: `mobile`, `tablet`, `desktop`. |
107+
| `--wait <ms>` | Post-load wait before evaluating snippets. Default: `3000`. |
108+
| `--budget-lcp <ms>` | Exit `1` if LCP exceeds this value. |
109+
| `--budget-cls <score>` | Exit `1` if CLS exceeds this value. |
110+
| `--verbose` | Show all items, including passing checks. |
111+
| `--headed` | Show the browser window (debug). |
112+
| `-h, --help` | Show help. |
70113

71114
### Exit codes
72115

0 commit comments

Comments
 (0)