provides an experimental turbo mode that enables SPA-like navigation.
It combines techniques from
@hotwired/turbo, but taking advantage of the architecture of every site to achieve it in under 2kb.
You can see it in action in this site!
In most sites, standard navigation should already be quite fast given allows you to generate sites without any blocking JS, and the interactive pieces are prerendered at build time.
However, since it's very lightweight, it's compatible with the standard lifecycle of any of the supported frameworks, and it will progressively enhance the site, you can use it whenever a snappy navigation is preferrable.
script type="module"execute once
- For islands, use the lifecycle of each component as usual (
- In client scripts, use the
onLoadcallback for effects that should run on every page load
- Code outside components or callbacks won't run on each page navigation
- Add the
onceattribute to non-module scripts that should only execute once
It's possible to avoid unmounting islands that don't change from one page navigation to the other, making them automatically "permanent" (in the
@hotwired/turboterminology) without any intervention from the user.
That would allow persistent components typically found in SPAs like shopping carts to work seamlessly.