From 13d88d8b0079bfa1ca5c1384af7756c0dd50e43b Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Thu, 9 Jun 2022 18:15:37 +0200 Subject: [PATCH 1/2] fix regression This is a regression where `%>utility<%` didn't properly abstract `utility` --- src/lib/defaultExtractor.js | 4 ++-- tests/default-extractor.test.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/lib/defaultExtractor.js b/src/lib/defaultExtractor.js index 973250ea4d5a..98bc7386baca 100644 --- a/src/lib/defaultExtractor.js +++ b/src/lib/defaultExtractor.js @@ -43,7 +43,7 @@ function* buildRegExps(context) { /(?![{([]])/, // optionally followed by an opacity modifier - /(?:\/[^\s'"\\$]*)?/, + /(?:\/[^\s'"\\><$]*)?/, ]), regex.pattern([ @@ -58,7 +58,7 @@ function* buildRegExps(context) { ]), // Normal values w/o quotes — may include an opacity modifier - /[-\/][^\s'"\\$={]*/, + /[-\/][^\s'"\\$={><]*/, ]) ), ]), diff --git a/tests/default-extractor.test.js b/tests/default-extractor.test.js index 789f2eb5d685..4e1792e8e7b9 100644 --- a/tests/default-extractor.test.js +++ b/tests/default-extractor.test.js @@ -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( + `
test
` + ) + + expect(extractions).toContain('bg-blue-200') + expect(extractions).toContain('shadow-xl') + expect(extractions).not.toContain('>shadow-xl') + expect(extractions).not.toContain('shadow-xl<') +}) From a2dc5ac83f43ef933b3857c7ceb24f93e5fe31a8 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Thu, 9 Jun 2022 18:17:10 +0200 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbe8c35dbcae..521b39bba276 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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