Skip to content

Releases: benshawuk/sparke

v1.1.0

09 Jun 21:28

Choose a tag to compare

What's new

  • data-revalidate — stale-while-revalidate freshness for preloaded pages
  • data-preloadvisible and hover preload scopes
  • Alpine / Livewire — swap-time teardown and wire:navigate deference

CDN

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

jsDelivr may take a few minutes to pick up the new tag.

Sparke v1.0.1

02 Jun 16:45

Choose a tag to compare

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.

Sparke v1.0.0

02 Jun 15:38

Choose a tag to compare

First public release of Sparke - make a multi-page website feel like an instant SPA.

A tiny, zero-dependency, progressive-enhancement script: it preloads same-origin links while the browser is idle and atomically swaps page content from memory on click. If JavaScript is unavailable, the browser just behaves as a normal MPA.

Install

<!-- self-hosted (recommended) -->
<script src="/js/sparke.min.js" defer></script>

<!-- or via CDN -->
<script src="https://cdn.jsdelivr.net/gh/benshawuk/sparke@v1.0.0/sparke.min.js" defer></script>

sparke.min.js is ~4.4 KB gzip / ~3.8 KB brotli. See the README for full docs.

Highlights

  • Preload + atomic swap (single <main> or whole <body>)
  • GET-form interception, redirect handling, Back/Forward cache restore
  • Opt-in View Transitions, zero-JS loading state, active-link highlighting
  • Per-page head CSS sync, accessible focus + live-region announcements
  • No build step, no config, no global - just one <script> tag