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

Normalize arbitrary modifiers #11057

Merged
merged 2 commits into from
Apr 21, 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 @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 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))
- Normalize arbitrary modifiers ([#11057](https://github.com/tailwindlabs/tailwindcss/pull/11057))

## [3.3.1] - 2023-03-30

Expand Down
6 changes: 1 addition & 5 deletions src/util/pluginUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,7 @@ export function parseColorFormat(value) {
}

function unwrapArbitraryModifier(modifier) {
modifier = modifier.slice(1, -1)
if (modifier.startsWith('--')) {
modifier = `var(${modifier})`
}
return modifier
return normalize(modifier.slice(1, -1))
}

export function asColor(modifier, options = {}, { tailwindConfig = {} } = {}) {
Expand Down
15 changes: 15 additions & 0 deletions tests/arbitrary-values.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,4 +637,19 @@ crosscheck(({ stable, oxide }) => {
`)
})
})

it('should support underscores in arbitrary modifiers', () => {
let config = {
content: [{ raw: html`<div class="text-lg/[calc(50px_*_2)]"></div>` }],
}

return run('@tailwind utilities', config).then((result) => {
return expect(result.css).toMatchFormattedCss(css`
.text-lg\/\[calc\(50px_\*_2\)\] {
font-size: 1.125rem;
line-height: calc(50px * 2);
}
`)
})
})
})