News for hackers. Stuff that matters.
Re:Web Components Eliminate JavaScript Framework Lock-In by gitaarik on Tuesday November 28, 2023 @10:22AM (#38446636)
Cool solution. I'm using Lit, and implemented a different approach to this problem. I created a way to easily apply a set of styles to particular components, by using a mixin class:

const myStyles = litStyle(css`h1 { color: red; }`);

class MyComponent extends myStyles(LitElement) { // ..}

You can store the style definition in a separate file and import it and use it for the components that you want it for.

https://github.com/gitaarik/lit-style

There are no comments on this comment yet.