This is a testing sandbox for Lit and SSR.
The purpose of this is to explore the possibility of an alternative to the currently popular meta-frameworks for proprietary UI libraries. What if we could build an app with just standard web components?
Currently this sandbox is a bare bones example of server side rendering a simple component.
To get started, ensure you have Node.js 18 and install dependencies:
npm install
We have a component defined in components/ui-alert.mjs, and our entry file which runs SSR is index.mjs. We can run it now:
npm start
You should see the following output:
Rendering...
Done ✨
Result HTML:
<!--lit-part QVXr6EG7LjU=--><ui-alert message="It's lit!"><template shadowroot="open" shadowrootmode="open"><!--lit-part y1KkPXWsCxI=--><p aria-role="alert"><!--lit-part-->It's lit!<!--/lit-part--></p><!--/lit-part--></template></ui-alert><!--/lit-part-->
The result HTML can be provided on the server side. Note the template and special comments which enables client side hydration.
There are many, but most notably:
- Lit is a dependency. While this is a conscious choice to reduce boilerplate and provide useful features that other UI libraries provide, it's technically not pure web components.
- Lit's SSR feature is experimental, but there are integrations with popular frameworks including Eleventy and Astro.
- Developing a meta-framework for Lit would be extremely time consuming, but it would be a great option to have for anyone wishing to build evergreen websites.