Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix candidate extractor regression #8558

Merged
merged 2 commits into from Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
### Fixed

- Fix candidate extractor regression ([#8558](https://github.com/tailwindlabs/tailwindcss/pull/8558))

## [3.1.0] - 2022-06-08

Expand Down
4 changes: 2 additions & 2 deletions src/lib/defaultExtractor.js
Expand Up @@ -43,7 +43,7 @@ function* buildRegExps(context) {
/(?![{([]])/,

// optionally followed by an opacity modifier
/(?:\/[^\s'"\\$]*)?/,
/(?:\/[^\s'"\\><$]*)?/,
]),

regex.pattern([
Expand All @@ -58,7 +58,7 @@ function* buildRegExps(context) {
]),

// Normal values w/o quotes — may include an opacity modifier
/[-\/][^\s'"\\$={]*/,
/[-\/][^\s'"\\$={><]*/,
])
),
]),
Expand Down
11 changes: 11 additions & 0 deletions tests/default-extractor.test.js
Expand Up @@ -438,3 +438,14 @@ test('with double quotes array within function', async () => {
expect(extractions).toContain('pl-1.5')
expect(extractions).not.toContain('pl-1')
})

test('with angle brackets', async () => {
const extractions = defaultExtractor(
`<div class="bg-blue-200 <% if (useShadow) { %>shadow-xl<% } %>">test</div>`
)

expect(extractions).toContain('bg-blue-200')
expect(extractions).toContain('shadow-xl')
expect(extractions).not.toContain('>shadow-xl')
expect(extractions).not.toContain('shadow-xl<')
})