News for hackers. Stuff that matters.
Re:Microsoft Fast Design by GordonS on Saturday August 08, 2020 @02:01PM (#24093713)
> You Can't SSR a Web Component - Strictly speaking, this is not quite correct. Custom elements are just html tags and can be rendered by any server framework. If you want to SSR the shadow DOM itself, that's possible by inlining the template and using a small bit of JS to attach the shadow after streaming the template in. That said, as mentioned, we are working on declarative shadow dom, which will provide the W3C standard on which SSR and other WC capabilities will be built.

I mainly develop using ASP.NET Core, with some vanilla JS as needed.

I'm just starting to hear about Web Components, and have heard that you can't use them with SSR because of the shadow DOM. I don't actually know what shadow DOM is, but does this mean no Web Components work with SSR, or that some don't? What precisely is the issue?

Re:Microsoft Fast Design by lioeters on Saturday August 08, 2020 @02:23PM (#24093870)
According to a fairly recent article (Feb 2020):

> It's a common myth that you can't server side render Web Components. Turns out you can if you look in the right place.

https://dev.to/steveblue/server-side-rendering-web-component...

The article mentions a few libraries for this purpose.

- Vaadin Router - https://vaadin.com/router

- SkateJS - https://skatejs.netlify.app/

- SkateJS: Web component server-side rendering - https://github.com/skatejs/skatejs/tree/master/packages/ssr

This latter looks good, I hadn't seen that before.

As a possible successor to React, Vue, et al, there's a wide range of functionality expected of Web Components. Server-side rendering of shadow DOM (I don't know what that really means, but) seems to be one of the tough questions yet to find a definitive answer.