Re: [WICG/webcomponents] Declarative CSS Module Scripts (#939)

@EisenbergEffect I appreciate your comment, but most of these things should be covered by `<link rel="stylesheet">` and `@sheet` (which can be used together with fragment URLs, according to [this resolution](https://github.com/w3c/csswg-drafts/issues/5629#issuecomment-1498299448)), and some of the points feel subjective and abstract. Today, `<link rel="stylesheet">` is already a performant way to handle styling in DSD, which is why I'm asking specifically what this proposal adds on top of it.

Since you mentioned modules, I want to highlight that this proposal doesn't really address that (hence the name "CSS module **scripts**"). True CSS modules would need to be usable within CSS itself, even before HTML or JS is involved. I'd imagine that modules would allow a `@sheet` to be `@import`ed into another CSS file and applied there.

It's also worth pointing out that DSD still requires repetition of the shadow markup today. When we get HTML modules (and/or DCE), it would reduce this markup repetition. Since `<style>`/`<link>` is just markup, HTML modules basically solve this problem of repeated styles. This is also why I think it makes more sense to pursue HTML modules first.

Lastly, I want to highlight https://github.com/w3c/csswg-drafts/issues/10013, which was recently greenlit. It may sound unrelated, but in my mind it opens up the potential for these two things to refer to exact same stylesheet instance:

```html
<link rel="stylesheet" href="design-system.css#button">
```

```js
import buttonStyles from "design-system.css#button" with { type: "css" };
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/939#issuecomment-2195766264
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/939/2195766264@github.com>

Received on Thursday, 27 June 2024 22:25:44 UTC