[csswg-drafts] [css-cascade-5] Allow authors to explicitly place unlayered styles in the cascade layer order (#6323)

mirisuzanne has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-cascade-5] Allow authors to explicitly place unlayered styles in the cascade layer order ==
Regarding [CSS Cascade 5 (cascade layers)](https://drafts.csswg.org/css-cascade-5/),
@jensimmons commented on [another thread about layer ordering](https://github.com/w3c/csswg-drafts/issues/6284#issuecomment-841428410):

> Would it be possible to allow Authors to set for themselves where in the cascade the "unlayered layer" resides? Maybe they even want to sandwich it in-between. A mechanism that's part of however they define the named layers & determine which layer is "first" & "second", etc.

By default unlayered style come first (lowest cascade priority) in the source order, but this would allow more explicit placement. Roughly (pseudo-code):

```css
/* the default behavior */
@layer <unlayered-styles>, reset, framework, components, utilities;

/* placed "in-between" layers */
@layer reset, framework, <unlayered-styles>, components, utilities;

/* placed at the top/end of the layer order */
@layer reset, framework, components, utilities, <unlayered-styles>;
```

I think that feature makes a lot of sense, and I would likely use it as an author. A few considerations to keep in mind, as we develop a mechanism for this:

- I would expect it to be repeatable for implicit sub-layers, as well the implicit outer layer
- Since all layer names are currently custom-idents, we either need a reserved name, or some way of distinguishing the provided implicit-layer ident from author-provided idents.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6323 using your GitHub account


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

Received on Friday, 28 May 2021 20:16:51 UTC