Skip to content

Commit b162ae7

Browse files
RobinMalfaitthecrypticace
authored andcommitted
Ensure variants with arbitrary values and a modifier are correctly matched in the RegEx based parser (#12179)
* add failing test * ensure variants can have modifiers in regex * update changelog
1 parent 58b126f commit b162ae7

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
- Eliminate irrelevant rules when applying variants ([#12113](https://github.com/tailwindlabs/tailwindcss/pull/12113))
2626
- Improve RegEx parser, reduce possibilities as the key for arbitrary properties ([#12121](https://github.com/tailwindlabs/tailwindcss/pull/12121))
2727
- Fix sorting of utilities that share multiple candidates ([#12173](https://github.com/tailwindlabs/tailwindcss/pull/12173))
28+
- Ensure variants with arbitrary values and a modifier are correctly matched in the RegEx based parser ([#12179](https://github.com/tailwindlabs/tailwindcss/pull/12179))
2829

2930
## [3.3.3] - 2023-07-13
3031

src/lib/defaultExtractor.js

+6
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,18 @@ function* buildRegExps(context) {
8181
// This is here to provide special support for the `@` variant
8282
regex.pattern([/@\[[^\s"'`]+\](\/[^\s"'`]+)?/, separator]),
8383

84+
// With variant modifier (e.g.: group-[..]/modifier)
85+
regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]\/\w+/, separator]),
86+
8487
regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/, separator]),
8588
regex.pattern([/[^\s"'`\[\\]+/, separator]),
8689
]),
8790

8891
// With quotes allowed
8992
regex.any([
93+
// With variant modifier (e.g.: group-[..]/modifier)
94+
regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s`]+\]\/\w+/, separator]),
95+
9096
regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s`]+\]/, separator]),
9197
regex.pattern([/[^\s`\[\\]+/, separator]),
9298
]),

0 commit comments

Comments
 (0)