You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/use-layers.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,7 +91,7 @@ When `allowUnnamedLayers` is set to `true`, the following code is **correct**:
91
91
92
92
#### `layerNamePattern`
93
93
94
-
The `layerNamePattern` is a regular expression string that allows you to validate the name of layers and prevent misspellings.
94
+
The `layerNamePattern` is a regular expression string that allows you to validate the name of layers and prevent misspellings. This option supports period-separated layer names (e.g., `foo.bar`) as defined in [CSS Cascade and Inheritance Level 5](https://drafts.csswg.org/css-cascade-5/#layer-names).
95
95
96
96
Here's an example of **incorrect** code:
97
97
@@ -106,8 +106,21 @@ Here's an example of **incorrect** code:
106
106
color: red;
107
107
}
108
108
}
109
+
110
+
/* unknown period-separated layer name */
111
+
@layer theme.custom {
112
+
a {
113
+
color: red;
114
+
}
115
+
}
109
116
```
110
117
118
+
Each part of a period-separated layer name is validated individually against the pattern. For example, with `layerNamePattern: "^(reset|theme|base)$"`:
119
+
120
+
-`theme.base` is valid (both parts match the pattern)
121
+
-`theme.custom` is invalid (`custom` doesn't match the pattern)
122
+
-`other.base` is invalid (`other` doesn't match the pattern)
123
+
111
124
#### `requireImportLayers: false`
112
125
113
126
When `requireImportLayers` is set to `false`, the following code is **correct**:
0 commit comments