Skip to content
lit-corePublic

About

Native Rust AOT compiler toolchain for Lit and Web Components. Eliminates Shadow DOM style bloat, runtime template parsing, and hydration bottlenecks at build time—outputting hyper-optimized Lit bundles, zero-JS resumable SSR, standalone vanilla Custom Elements, or native React components.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

104 Commits

Folders and files

Repository files navigation

lit-core

CI Deploy Benchmarks Node.js version Rust toolchain License: MIT

@lit-core is an ahead-of-time Rust compiler and rendering toolchain for Lit and Web Components.

Web Components give teams browser-native style and DOM encapsulation, but standard builds pay for that isolation in the browser. Each component carries its own copy of shared styles, parses HTML templates at runtime, walks the DOM to wire bindings, and downloads client JavaScript before server-rendered markup can respond to user input. Sharing those components across non-Lit applications usually means maintaining wrapper layers that still ship two runtimes.

@lit-core moves that work to the build step. Developers write standard Lit components once, and the compiler optimizes styles and templates across the module graph, strips unused code, and outputs smaller Lit bundles, standalone Custom Elements, native components for other frameworks, or streaming server-rendered HTML that wakes up on interaction.

Capabilities

Bundle and runtime optimization

Deduplicates repeated Shadow DOM stylesheets and static markup across components into shared constructable sheets and reusable fragments. Precompiles templates, lowers decorators and directives, delegates events, and shakes unused custom element registrations so browsers ship less code and mount components with minimal main-thread work.

Server streaming and resumability

Streams Declarative Shadow DOM directly from Node.js and edge workers. Server-only data loaders and actions are split out of client bundles at build time, while interactive components remain dormant as pure HTML and CSS until a user interacts with them.

Cross-target compilation

Compiles Lit components into standalone vanilla Custom Elements or native framework components (such as React 19) when shipping the Lit runtime is unnecessary.

Drop-in bundler integration

Integrates directly into Vite, Rollup, and Webpack. Existing Lit codebases get whole-graph compilation, chunk-aware stylesheet sharing, and server/client asset coordination without changing component code or adding manual runtime glue.

Benchmarks and verification

Compiler passes and runtimes are tested against production component libraries including Carbon Web Components, Spectrum Web Components, Web Awesome, Material Web, and Cisco Momentum.

Documentation

License

MIT

About

Native Rust AOT compiler toolchain for Lit and Web Components. Eliminates Shadow DOM style bloat, runtime template parsing, and hydration bottlenecks at build time—outputting hyper-optimized Lit bundles, zero-JS resumable SSR, standalone vanilla Custom Elements, or native React components.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Used by

Contributors

Languages