Re: [csswg-drafts] [css-conditional-5][css-nesting-1] Allow browsers with Nesting support to suppress stylesheet imports (#9082)

_(Just spitting out some wild ideas here. Maybe it can spark some more ideas or options in other peoples minds.)_

One idea that crossed my mind is to add some type of way to skip a successive `@import` when importing a stylesheet would succeed. Something to indicate that the next `@import` should be ignored.…

```css
@import "nested-and-small.css" supports(<method-to-detect-nesting>) skip-next;
@import "not-nested-and-large.css";
```

Seems nasty and brittle, but maybe it could work. Additionally, it would also require additions to `<link>` so that it could work in a similar way.

---

Another way might being able to flag certain resources as _“ignore these when you encounter them”_? Building upon https://github.com/w3c/csswg-drafts/issues/9109 that could be something like this:

```css
@config {
  legacy: 'not-nested-and-large.css';
}

@import "nested-and-small.css" supports(<method-to-detect-nesting>);
@import "not-nested-and-large.css";
```

Or if one wants to add conditions (which would replicate a lot of `@import`)

```css
@config {
  import-ignore: 'not-nested-and-large.css' not supports(<method-to-detect-nesting>);
}
```

This, however, would tie both features together which seems like a crazy thing to require.

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


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

Received on Tuesday, 25 July 2023 00:32:42 UTC