public static class LayerRuleParserReads the @layer rules ExCSS hands back unparsed.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
ExCSS 4.3.2 predates cascade layers. It does not fail on one — it hands the whole rule back as an unknown rule with its text intact, which [the spike](../../docs/plan/spikes/vcss-excss/RESULT.md) established before any of this was built. So this reads the prelude and hands the body back to ExCSS, and the rest of the engine never learns that the front end had a gap.
Two forms, and they do different jobs. The statement @layer a, b; fixes the order without contributing rules, which is the only way to say "utilities lose to components" at the top of a file when the utilities are generated into it later. The block @layer a { … } contributes rules to a layer, creating it at that position if nothing has named it yet. An anonymous @layer { … } is its own layer that nothing can ever add to again.
Deliberately a small hand-written reader rather than a tokenizer. A prelude is a comma-separated list of dotted identifiers and a body is brace-balanced text; anything more elaborate would be inventing a problem. What it does have to get right is brace balance inside strings and comments, because a content: "}" in the body would otherwise cut the layer in half.
Methods (2)
public static bool IsLayerRule(string? text)Whether some unparsed rule text is an @layer rule.
public static bool TryParse(string? text, out LayerRule rule)Reads an @layer rule.
Used by (2)
- StyleSheetLoaderVixen.Ui.Styling
- StyleSheetLoadingTestsVixen.Ui.Styling.Tests