Skip to content

Commit

Permalink
Fix support for container query utilities with arbitrary values (#12534)
Browse files Browse the repository at this point in the history
* Fix support for container query utilities with arbitrary values

* Update changelog
  • Loading branch information
thecrypticace committed Dec 5, 2023
1 parent 3125829 commit cc94c76
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
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 support for container query utilities with arbitrary values ([#12534](https://github.com/tailwindlabs/tailwindcss/pull/12534))

## [3.3.6] - 2023-12-04

Expand Down
7 changes: 6 additions & 1 deletion src/lib/defaultExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ function* buildRegExps(context) {
// Utilities
regex.pattern([
// Utility Name / Group Name
/-?(?:\w+)/,
regex.any([
/-?(?:\w+)/,

// This is here to make sure @container supports everything that other utilities do
/@(?:\w+)/,
]),

// Normal/Arbitrary values
regex.optional(
Expand Down
16 changes: 16 additions & 0 deletions tests/default-extractor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,19 @@ it.each([
expect(extractions).toContain(value)
}
})

it.each([
['@container', ['@container']],
['@container/sidebar', ['@container/sidebar']],
['@container/[sidebar]', ['@container/[sidebar]']],
['@container-size', ['@container-size']],
['@container-size/sidebar', ['@container-size/sidebar']],
['@container-[size]/sidebar', ['@container-[size]/sidebar']],
['@container-[size]/[sidebar]', ['@container-[size]/[sidebar]']],
])('should support utilities starting with @ (%#)', async (content, expectations) => {
let extractions = defaultExtractor(content)

for (let value of expectations) {
expect(extractions).toContain(value)
}
})

0 comments on commit cc94c76

Please sign in to comment.