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

Ensure multiple theme(spacing[5]) calls with bracket notation in arbitrary properties work #11039

Merged
merged 2 commits into from
Apr 19, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Inherit gradient stop positions when using variants ([#11002](https://github.com/tailwindlabs/tailwindcss/pull/11002))
- Honor default `to` position of gradient when using implicit transparent colors ([#11002](https://github.com/tailwindlabs/tailwindcss/pull/11002))
- Ensure `@tailwindcss/oxide` doesn't leak in the stable engine ([#10988](https://github.com/tailwindlabs/tailwindcss/pull/10988))
- Ensure multiple `theme(spacing[5])` calls with bracket notation in arbitrary properties work ([#11039](https://github.com/tailwindlabs/tailwindcss/pull/11039))

## [3.3.1] - 2023-03-30

Expand Down
2 changes: 1 addition & 1 deletion src/lib/defaultExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function* buildRegExps(context) {
// This is a targeted fix to continue to allow theme()
// with square brackets to work in arbitrary properties
// while fixing a problem with the regex matching too much
/\[[^\s:'"`]+:[^\s]+?\[[^\s]+?\][^\s]+?\]/,
/\[[^\s:'"`]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,

// Utilities
regex.pattern([
Expand Down
7 changes: 7 additions & 0 deletions tests/default-extractor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ const htmlExamples = html`
<div class="[--y:theme(colors.blue.500)]">
<div class="w-[calc(100%-theme('spacing.1'))]">
<div class='w-[calc(100%-theme("spacing.2"))]'>
<div class='w-[calc(100%-theme("spacing[2]"))]'>
<div class='w-[calc(100%-theme(spacing[2]))]'>
<div class='[width:calc(theme(spacing[2])_+_theme(spacing[3])_+_theme(spacing[4]))]'>

<script>
let classes01 = ["text-[10px]"]
Expand Down Expand Up @@ -146,6 +149,10 @@ const includes = [
`[--y:theme(colors.blue.500)]`,
`w-[calc(100%-theme('spacing.1'))]`,
`w-[calc(100%-theme("spacing.2"))]`,
`w-[calc(100%-theme("spacing.2"))]`,
`w-[calc(100%-theme("spacing[2]"))]`,
`w-[calc(100%-theme(spacing[2]))]`,
`[width:calc(theme(spacing[2])_+_theme(spacing[3])_+_theme(spacing[4]))]`,
`border-[color:var(--color,theme(colors.cyan.500))]`,
`translate-x-[var(--scroll-offset)]`,
`font-[arbitrary,'arbitrary_with_space']`,
Expand Down