Build web components from any backend.
WeSC is a streaming HTML/web-component bundler written in Rust (via
lol-html). It compiles
single-file .html components into Declarative-Shadow-DOM-ready
output: a standalone CLI, plus sync / async / streaming Node bindings
(via napi-rs) and Python bindings (via
PyO3).
- HTML first (The Rule of Least Power)
- Stay close to web standards (DSD, slots,
<template>) - A first-class authoring experience for single-file components
- Usable from any backend (standalone CLI; Node and Python bindings today, more welcome)
WeSC is an HTML component bundler. It lets developers author web components as single-file components (SFCs), then compiles those components into final HTML plus optional CSS and JS bundles.
WeSC is not meant to replace full-featured template engines. It does not try to own variables, conditionals, loops, layouts, partials, or application data flow. Use Handlebars, Nunjucks, Twig, React, your backend framework, or plain string output for that layer. WeSC sits beside them: it turns component definitions into reusable HTML building blocks that can be stamped by whatever renders your data.
| Path | What |
|---|---|
packages/wesc |
The wesc npm package: CLI + Node bindings for the bundler. |
packages/dom |
The @wesc/dom npm package: DOM SSR via Linkedom. |
crates/wesc |
The Rust bundler core (lol-html). |
crates/wesc-node |
napi-rs Node bindings. |
crates/wesc-py |
PyO3 Python bindings. |
examples |
Bundler examples (departures-board, node-server, python-server). |
This is an npm-workspaces monorepo. From the repo root:
npm install # installs every workspace
npm test # runs each package's tests
npm run lint # lints each package
npm run build # builds each package (esbuild for @wesc/dom)
npm run build:native # builds the native bundler addon (Rust toolchain)Built on
Related projects
- WebC — single-file web-component format from the 11ty team.