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

Improve jsx interpolation candidate matching #6593

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve circular dependency detection when using `@apply` ([#6588](https://github.com/tailwindlabs/tailwindcss/pull/6588))
- Only generate variants for non-`user` layers ([#6589](https://github.com/tailwindlabs/tailwindcss/pull/6589))
- Properly extract classes with arbitrary values in arrays and classes followed by escaped quotes ([#6590](https://github.com/tailwindlabs/tailwindcss/pull/6590))
- Improve jsx interpolation candidate matching ([#6593](https://github.com/tailwindlabs/tailwindcss/pull/6593))

## [3.0.6] - 2021-12-16

Expand Down
2 changes: 1 addition & 1 deletion src/lib/defaultExtractor.js
Expand Up @@ -17,7 +17,7 @@ const PATTERNS = [
].join('|')

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

/**
* @param {string} content
Expand Down
7 changes: 5 additions & 2 deletions tests/default-extractor.test.js
@@ -1,7 +1,9 @@
import { html } from './util/run'
import { defaultExtractor } from '../src/lib/defaultExtractor'

const input = html`
let jsxExample = "<div className={`overflow-scroll${conditionIsOpen ? '' : ' hidden'}`}></div>"
const input =
html`
<div class="font-['some_font',sans-serif]"></div>
<div class='font-["some_font",sans-serif]'></div>
<div class="bg-[url('...')]"></div>
Expand Down Expand Up @@ -44,7 +46,7 @@ const input = html`
uppercase:true
}
</script>
`
` + jsxExample

const includes = [
`font-['some_font',sans-serif]`,
Expand Down Expand Up @@ -84,6 +86,7 @@ const includes = [
`lg:text-[24px]`,
`content-['>']`,
`hover:test`,
`overflow-scroll`,
]

const excludes = [
Expand Down