Skip to content

[css-cascade-7] @sheet - allow nested @sheet statements? #11999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
KurtCattiSchmidt opened this issue Mar 24, 2025 · 3 comments
Open

[css-cascade-7] @sheet - allow nested @sheet statements? #11999

KurtCattiSchmidt opened this issue Mar 24, 2025 · 3 comments

Comments

@KurtCattiSchmidt
Copy link

This was discussed a bit in April 2023 but didn't land on a specific resolution for this behavior: #5629 (comment)

If you have a file named my_css.css as follows:

* { font-family: serif; }
@sheet foo {
  @sheet bar {
    font-family: sans-serif;
  }
  font-family: serif;
}

Should this be allowed? If so, it could follow the precedent for @layer and allow nested sheets via the . syntax:

<link rel="my_css.css" sheet="foo.bar" />

As mentioned in the above CSSWG discussion, we'd need to be explicit about how @import works in these cases (which would need some careful considerations), but before we get to that, we should resolve to support nested @sheet blocks at all.

@romainmenke
Copy link
Member

I think this should be supported.
I don't really see a reason not to allow this.

Imported stylesheets can themselves contain @import statements.

@astearns astearns moved this to FTF agenda items in CSSWG April 2025 meeting agenda Mar 24, 2025
@astearns astearns moved this from FTF agenda items to By Topic in CSSWG April 2025 meeting agenda Mar 27, 2025
@astearns astearns moved this from By Topic to Wednesday Morning in CSSWG April 2025 meeting agenda Mar 27, 2025
@mirisuzanne
Copy link
Contributor

This makes sense to me, I'm in favor of the syntax as proposed. But I expect most of the complexity comes in answering all the questions about import.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-cascade-7] @sheet - allow nested @sheet statements?, and agreed to the following:

  • RESOLVED: Allow nested @sheet statements and follow the nested layer syntax
The full IRC log of that discussion <emeyer> kurt: For @sheet, should we allow sheets to be nested? It would be similar to @layer
<emeyer> …They should also be delimited with a period, like with layers
<emeyer> …My proposal is that we allow this for consistency
<TabAtkins> q+
<astearns> ack TabAtkins
<emeyer> TabAtkins: This sounds reasonable; what’s the complexity about @import?
<emeyer> kurt: The behavior of @import in @sheet isn’t well defined yet
<emeyer> TabAtkins: Do you foresee any extra complexity?
<emeyer> kurt: I don’t
<emeyer> astearns: It makes sense to me to follow the layers model
<bramus> +1
<emeyer> astearns: Proposed resolution is to allow nested @sheet statements and follow the nested layer syntax
<emeyer> RESOLVED: Allow nested @sheet statements and follow the nested layer syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Thursday Morning
Development

No branches or pull requests

4 participants