Skip to content
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 @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Escape special characters in resolved content base paths ([#9650](https://github.com/tailwindlabs/tailwindcss/pull/9650))
- Don't reuse container for array returning variant functions ([#9644](https://github.com/tailwindlabs/tailwindcss/pull/9644))

## [3.2.1] - 2022-10-21

Expand Down
2 changes: 1 addition & 1 deletion src/lib/generateRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function applyVariant(variant, matches, context) {
let container = postcss.root({ nodes: [rule.clone()] })

for (let [variantSort, variantFunction, containerFromArray] of variantFunctionTuples) {
let clone = containerFromArray ?? container.clone()
let clone = (containerFromArray ?? container).clone()
let collectedFormats = []

function prepareBackup() {
Expand Down
37 changes: 37 additions & 0 deletions tests/variants.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1029,3 +1029,40 @@ test('class inside pseudo-class function :has', () => {
`)
})
})

test('variant functions returning arrays should output correct results when nesting', async () => {
let config = {
content: [{ raw: html`<div class="test:foo" />` }],
corePlugins: { preflight: false },
plugins: [
function ({ addUtilities, addVariant }) {
addVariant('test', () => ['@media (test)'])
addUtilities({
'.foo': {
display: 'grid',
'> *': {
'grid-column': 'span 2',
},
},
})
},
],
}

let input = css`
@tailwind utilities;
`

let result = await run(input, config)

expect(result.css).toMatchFormattedCss(css`
@media (test) {
.test\:foo {
display: grid;
}
.test\:foo > * {
grid-column: span 2;
}
}
`)
})