2

我正在尝试为我想通过 stylelint 允许的选择器类模式找出正确的正则表达式

https://stylelint.io/user-guide/rules/selector-class-pattern/

我只想允许用连字符分隔的小写字母和数字,并且只允许开头的下划线。所以基本上如下

.this-is-good
.also-good2
._this-works-too

.-not-this
.or-this-
.and_not_this
.OR-This

我几乎让它工作了,但不能让它只在模式的开头允许下划线。

"selector-class-pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
4

0 回答 0