# About

> Why sitelo exists — from javascript-to-html to vite-plugin-html-pages to a full static-site toolkit.

sitelo didn’t start as a framework. It started as an itch to write markup in a way that felt natural in JavaScript — and kept growing until the whole path from page file to shipped site was covered.

## javascript-to-html

First came [javascript-to-html](https://www.npmjs.com/package/javascript-to-html) (also known as [ht.js](https://ht.js.org)): a simple, intuitive way to generate HTML in JavaScript, without complex templating engines or frameworks.

Given how ubiquitous full-featured frameworks like React had become, finding a simple templating solution that didn’t include the kitchen sink was surprisingly hard. By focusing only on transforming JavaScript to HTML — basically functions that return strings — ht.js stays lightweight, easy to use, flexible, and extensible.

That small surface means it fits many places: directly in the frontend (SPA-style), in a build to create static sites (SSG), or even for server-side rendering (SSR).

## Teaching Vite to emit HTML

That solved authoring. The next problem was the build: Vite treats `.js` / `.ts` as scripts, not as pages. I needed a convention where certain modules were *meant* to become HTML.

The idea was straightforward: files named `*.ht.js`, `*.html.js`, `*.ht.ts`, and friends should be processed into HTML instead of bundled as client JavaScript. That convention became [vite-plugin-html-pages](https://www.npmjs.com/package/vite-plugin-html-pages) — file-based routing, data loading, assets, and static generation on top of Vite.

## sitelo

sitelo wraps Vite and that plugin into one install and one CLI. You get a holistic, top-notch developer experience: `sitelo` for a live server, `sitelo build` for production, sensible defaults, and the plugin’s page model without assembling the toolchain yourself.

Same idea all the way down: pages are modules that return HTML. sitelo is the layer that makes that idea feel finished.

## Components and server islands

Functions that return HTML turned out to compose all the way up. [sitelo-ui](https://sitelo.dev/docs/ui) is a component library built the same way — buttons, cards, forms, tables, modals and page sections, each one a function that returns a string. No compiler, no runtime, no hydration: what you build is what lands in `dist/`.

Not every region of a page can be static, though. [Server islands](https://sitelo.dev/docs/islands) keep the page static and render just the parts that need fresh, per-request data — comments under a cached post, a stock badge on a product page — on a server when the page is viewed. An island is, again, a function that returns HTML: the build ships its fallback, and a tiny loader swaps in the rendered fragment.

Neither changes the model. There is still no client framework — just HTML out of functions, at build time or at request time.

## How it compares

Plenty of good tools already ship static sites. sitelo’s niche is narrow on purpose: JavaScript (or TypeScript) functions that return HTML, with Vite’s dev experience, and as little framework as possible.

| Tool | Model | Reach for it when |
| --- | --- | --- |
| sitelo | JS/TS functions → HTML on Vite, plus components and server islands | You want HTML out of JavaScript with a real Vite workflow — components and per-request regions included, no client framework or hydration |
| Astro | Framework components + client and server islands, own compiler | You want to hydrate React, Vue or Svelte components in the browser, with a bigger ecosystem |
| Next.js | Full React app (SSR / SSG / ISR) | You’re building an application in the React ecosystem |
| Hugo | Go templates, very fast builds | Huge content sites and you’re happy in Go’s toolchain |
| Eleventy | Template languages → HTML | You want flexible templates (Nunjucks, Liquid, …) without a SPA framework |

If you want client-side components and hydration — use a framework. If you want HTML out of JavaScript functions with the Vite experience — components and server-rendered regions included — sitelo is the smallest tool that does the whole job.

[Read the docs](https://sitelo.dev/docs) · [GitHub](https://github.com/paul-browne/sitelo)
