Skip to content

Sparke v1.0.1

Choose a tag to compare

@benshawuk benshawuk released this 02 Jun 16:45
· 9 commits to main since this release

Adds the preloading system and fixes an image-warming bug.

Added

  • Whole-site crawl (data-preload, default all): bounded breadth-first preloading of the same-origin site, so a small site is fully warm after the first paint. page = one hop, none = off.
  • Image preloading (data-preload-images, default all): warms every <img> (incl. lazy + first srcset candidate) into the browser cache. off to disable.
  • LRU cache cap (data-cache-size, default 100) and Save-Data back-off (auto images-off + one-hop on data-saver).
  • Cache-Control: no-store pages are never cached.

Fixed

  • Image warming is now concurrency-capped (max 4 in flight). The initial cut fired a request for every image on every crawled page at once, flooding and getting rate-limited by image hosts (e.g. a CDN) - which broke the very images it was warming. The cap protects both the host and the user's bandwidth on slow connections.

Install

<script src="https://cdn.jsdelivr.net/gh/benshawuk/sparke@1/sparke.min.js" defer></script>

The @1 link auto-serves the latest 1.x patch. sparke.min.js is ~5 KB gzip.