LessJS generates pure static HTML with Declarative Shadow DOM. This is the ideal substrate for a PWA: pages are pre-rendered, assets are versioned hashes, and API routes can stay outside the static artifact on a serverless platform. The important rule is freshness: HTML should prefer network, while hashed assets can prefer cache.
Added to build-ssg.ts — after Phase 3, the SSG script generates:
manifest.json — Web App Manifest with name, theme_color, iconssw.js — Service Worker with NetworkFirst (HTML/API) + CacheFirst (assets)
<link rel="manifest"> + sw registration script
The build-ssg.ts script accepts a pwa option. When provided, it
generates manifest.json and sw.js in the output directory, and injects manifest links + sw
registration into every HTML file. The less() plugin already carries this option
through build metadata.
Benefit: offline access, instant repeat visits, installable on mobile. Cost: ~100 lines of
code. No dependency on Workbox. The current service worker intentionally avoids full precache
because stale index.html is worse than a first-load network request.