Skip to content

Instantly share code, notes, and snippets.

@darrenmothersele
Created November 27, 2019 07:55
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save darrenmothersele/7d7a02ad25c4a3117fb92aa762f8ef3c to your computer and use it in GitHub Desktop.
Save darrenmothersele/7d7a02ad25c4a3117fb92aa762f8ef3c to your computer and use it in GitHub Desktop.
Server side rendering of web components (ssr, custom elements, shadow dom)
Possible approaches to rendering web components on the server...
Server side DOM library (JSDOM alternative) that supports custom elements:
https://www.npmjs.com/package/happy-dom
https://medium.com/@treshugart/%C3%A5server-side-rendering-web-components-e5df705f3f48
Approach is based on this zip:
https://gist.github.com/justinfagnani/936791248120749ff1f8188f1f4064d9
Share a template between client side code and server side code:
https://blog.lamplightdev.com/2019/07/20/how-to-server-side-render-web-components/
@trusktr
Copy link

trusktr commented Feb 24, 2023

Lit SSR is fairly new: https://lit.dev/docs/ssr/overview/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment