Re: [csswg-drafts] Proposal: CSS @sheet (#11509)

@KurtCattiSchmidt [said](https://github.com/w3c/csswg-drafts/issues/11509#issuecomment-2632432120):

> Keep in mind that `@sheet` contents do not apply by default. So for these examples, you need an identifier, even if it's throw-away. So your example would look like:

> Does that fundamentally change your bundling scenario? Also, is this something existing `@layer` functionality could help with? I appreciate the scenarios you've provided and definitely want to make this feature useful! I don't have a lot of experience with bundling so this is super helpful context.

I only just now realized how `@sheet` and `@import` can indeed be used side by side.
How you can inline with `@sheet` while keeping the `@import` statements in the intended order. 
This only requires rewriting the `@import` statements so that they refer to the `@sheet` instead of a file.

Thank you for clarifying that.

(`@layer` can not be used to make bundled CSS more correct)

----

> > With that in mind I think that nesting should be allowed and that using `@import` in `@sheet` should also be allowed.

> If this were to be referenced by a `<link rel>` tag, how would you target bar? We could differentiate nested sheets with some sort of delimiter (e.g. if we used `#` to delimit between nested sheets this could be valid - `<link rel="stylesheet" href="index.css" sheet="foo#bar">`), but I am struggling to come up with a use case. What types of situations would nested `@sheet` definitions enable?

I think I am looking at this from a different perspective.

It is not so much that there is a specific need or use case for nested `@sheet`. Something that is only possible by having nested sheets.

Rather I think that it is something people will do. Either organically, automated by a tool or because they are not the only author.

A CSS author might write:

```css
@sheet foo {
  @import url("some-cdn.com/bootstrap.css");
}
```

And `bootstrap.css` might have:

```css
@sheet bootstrap { /* css 8/ }
```

This would result in a nested sheet, right?

I don't think there is a good reason to disallow this.

-- 
GitHub Notification of comment by romainmenke
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11509#issuecomment-2646179804 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 9 February 2025 11:09:07 UTC