Skip to content

Ordering custom CSS layers #5042

@jods4

Description

@jods4

UnoCSS version

66.1.2

Describe the bug

I have some custom css in a specific layer (called my-layer in repro below).
I need these rules to be in a precise position amongst other UnoCSS layers.

The layers config key serves this purpose, but only layers that are "used" by UnoCSS classes are included so it does not work in this situation.

Reproduction

Here's a small UnoCSS playground that demonstrate the issue.

Notice:

  • In configuration a layer "my-layer": 200 is declared.
  • In custom CSS pane, @layer my-layer is used. The content is processed by UnoCSS as demonstrated by @apply directive.
  • In output CSS, we can see that @layer at top of file does not list my-layer, so its ordering is not what I want. At the end of file you can see the custom CSS layer is actually included.

System Info

Check out UnoCSS playground

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions