Static rendering
@nisli/ssg renders nisli components to static HTML at build time. No client runtime is required for the initial paint — custom elements upgrade if and when you ship the scripts.
buildStaticSite
Give it an output directory and a list of routes; each route’s render returns a nisli template, which is rendered to HTML and written to disk.
build.ts
import { buildStaticSite } from '@nisli/ssg';
import { html } from '@nisli/core';
function homePage() {
return html`<main>Hello from nisli</main>`;
}
await buildStaticSite({
outDir: 'dist',
routes: [{ path: '/', render: () => homePage() }],
});
This very website is built this way — nisli pages, composed from @nisli/ui, rendered by @nisli/ssg to a static bundle and deployed to Cloudflare. It is the framework’s own dogfood.