Skip to content

Does nested @layer syntax work for declaring layer order? #5849

@frivoal

Description

@frivoal

nested cascade layer let you do this:

@layer out {
  @layer in1 {
    p { color: blue; }
  }
  @layer in2 {
    p { color: red; }
  }
}
@layer out.in2 {
  h1 { color: pink; }
}

Does the period notation also affect layer ordering? In other words, If I changed the above example to

@layer out.in2 {
  h1 { color: pink; }
}
@layer out {
  @layer in1 {
    p { color: blue; }
  }
  @layer in2 {
    p { color: red; }
  }
}

does that now mean that in2 is ordered before in1 rather than after? I suppose it does, as

@layer out.in2 {
  h1 { color: pink; }
}

is just syntatic sugar for

@layer out {
  @layer in2 {
    h1 { color: pink; }
  }
}

but it might be worth making it explicit.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions