Skip to content

Commit 9a5db88

Browse files
authored
Fix candidate extractor regression (#8558)
* fix regression This is a regression where `%>utility<%` didn't properly abstract `utility` * update changelog
1 parent c01ce5c commit 9a5db88

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- Nothing yet!
10+
### Fixed
11+
12+
- Fix candidate extractor regression ([#8558](https://github.com/tailwindlabs/tailwindcss/pull/8558))
1113

1214
## [3.1.0] - 2022-06-08
1315

src/lib/defaultExtractor.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function* buildRegExps(context) {
4343
/(?![{([]])/,
4444

4545
// optionally followed by an opacity modifier
46-
/(?:\/[^\s'"\\$]*)?/,
46+
/(?:\/[^\s'"\\><$]*)?/,
4747
]),
4848

4949
regex.pattern([
@@ -58,7 +58,7 @@ function* buildRegExps(context) {
5858
]),
5959

6060
// Normal values w/o quotes — may include an opacity modifier
61-
/[-\/][^\s'"\\$={]*/,
61+
/[-\/][^\s'"\\$={><]*/,
6262
])
6363
),
6464
]),

tests/default-extractor.test.js

+11
Original file line numberDiff line numberDiff line change
@@ -438,3 +438,14 @@ test('with double quotes array within function', async () => {
438438
expect(extractions).toContain('pl-1.5')
439439
expect(extractions).not.toContain('pl-1')
440440
})
441+
442+
test('with angle brackets', async () => {
443+
const extractions = defaultExtractor(
444+
`<div class="bg-blue-200 <% if (useShadow) { %>shadow-xl<% } %>">test</div>`
445+
)
446+
447+
expect(extractions).toContain('bg-blue-200')
448+
expect(extractions).toContain('shadow-xl')
449+
expect(extractions).not.toContain('>shadow-xl')
450+
expect(extractions).not.toContain('shadow-xl<')
451+
})

0 commit comments

Comments
 (0)