Skip to content

Commit 9e03a68

Browse files
RobinMalfaitlukewarlowthecrypticace
authored
Improve jsx interpolation candidate matching (#6593)
* ensure that strangely used jsx with interpolation gets detected Co-authored-by: Luke Warlow <[email protected]> Co-authored-by: Jordan Pittman <[email protected]> * update changelog Co-authored-by: Luke Warlow <[email protected]> Co-authored-by: Jordan Pittman <[email protected]>
1 parent 27c67fe commit 9e03a68

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Improve circular dependency detection when using `@apply` ([#6588](https://github.com/tailwindlabs/tailwindcss/pull/6588))
1414
- Only generate variants for non-`user` layers ([#6589](https://github.com/tailwindlabs/tailwindcss/pull/6589))
1515
- Properly extract classes with arbitrary values in arrays and classes followed by escaped quotes ([#6590](https://github.com/tailwindlabs/tailwindcss/pull/6590))
16+
- Improve jsx interpolation candidate matching ([#6593](https://github.com/tailwindlabs/tailwindcss/pull/6593))
1617

1718
## [3.0.6] - 2021-12-16
1819

src/lib/defaultExtractor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const PATTERNS = [
1717
].join('|')
1818

1919
const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g')
20-
const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%]*[^<>"'`\s.(){}[\]#=%:]/g
20+
const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g
2121

2222
/**
2323
* @param {string} content

tests/default-extractor.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { html } from './util/run'
22
import { defaultExtractor } from '../src/lib/defaultExtractor'
33

4-
const input = html`
4+
let jsxExample = "<div className={`overflow-scroll${conditionIsOpen ? '' : ' hidden'}`}></div>"
5+
const input =
6+
html`
57
<div class="font-['some_font',sans-serif]"></div>
68
<div class='font-["some_font",sans-serif]'></div>
79
<div class="bg-[url('...')]"></div>
@@ -44,7 +46,7 @@ const input = html`
4446
uppercase:true
4547
}
4648
</script>
47-
`
49+
` + jsxExample
4850

4951
const includes = [
5052
`font-['some_font',sans-serif]`,
@@ -84,6 +86,7 @@ const includes = [
8486
`lg:text-[24px]`,
8587
`content-['>']`,
8688
`hover:test`,
89+
`overflow-scroll`,
8790
]
8891

8992
const excludes = [

0 commit comments

Comments
 (0)