You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,7 @@ self-ignored `.reglance/` directory — nothing to add to `.gitignore`.
54
54
|`pixelmatchOptions`| no |[pixelmatch](https://github.com/mapbox/pixelmatch) options, e.g. `{ "threshold": 0.1 }`. |
55
55
|`timeouts`| no |`{ goto, settle }` in ms. `goto` bounds navigation; `settle` bounds each post-scroll wait (network idle, then image load/decode). Defaults `{ goto: 15000, settle: 8000 }`. Raise `settle` for slow, lazy-loading pages. |
56
56
|`blockHosts`| no | Hostnames to block requests to during capture, e.g. `["captcha.example.com"]`. Each entry also blocks its subdomains. |
57
+
|`imageCache`| no | Serve repeat image requests from a local cache during capture. `true` for a per-run cache, `{ "persist": true }` to keep it across runs. Off by default. |
57
58
58
59
`domain` is only needed by `capture`; `control` and `compare` work on the files
59
60
already captured. See [`reglance.example.json`](reglance.example.json) for a full
@@ -67,6 +68,20 @@ retries indefinitely will otherwise time out every viewport on pages that
67
68
embed it. Entries are bare hostnames; `"example.org"` blocks `example.org` and
68
69
`sub.example.org` alike.
69
70
71
+
`imageCache` keeps a capture run from swarming the origin with the same image
72
+
requests once per viewport per parallel context. Image requests are intercepted
73
+
in the browser: the first request for a URL is fetched from the origin and
74
+
stored under `.reglance/image-cache/`, and every repeat is answered locally —
75
+
simultaneous requests for the same URL share a single origin fetch. The full
76
+
URL, query string included, is the cache key, so CDN resize variants
77
+
(`photo.jpg?w=400` vs `photo.jpg?w=800`) stay distinct. Nothing in the page is
78
+
rewritten and only images are cached — the HTML, CSS, and JS under test always
79
+
load from the origin. With `true` the cache is cleared at the start of every
80
+
run, so within-run traffic drops with zero risk of a stale image masking a real
81
+
change. `{ "persist": true }` keeps the cache across runs — useful when
82
+
re-capturing repeatedly while iterating on CSS — but a changed origin image
83
+
will then go unnoticed until you clear it with `--fresh-images`.
84
+
70
85
A viewport's optional `deviceScaleFactor` (device pixel ratio) renders the page
71
86
as it would appear on a higher-density display — use `2` for a retina capture,
72
87
`3` for some phones. It defaults to `1`. Captures sharing a DPR run in one
@@ -101,6 +116,7 @@ Append path keys to limit a command to specific pages:
0 commit comments