mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Handle variable colors that have variable fallback values (#12049)
* Parse colors even when variable has fallback that is a variable * Update changelog
This commit is contained in:
parent
38fd41ea0b
commit
8012d1819b
@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Skip `calc()` normalisation in nested `theme()` calls ([#11705](https://github.com/tailwindlabs/tailwindcss/pull/11705))
|
||||
- Fix incorrectly generated CSS when using square brackets inside arbitrary properties ([#11709](https://github.com/tailwindlabs/tailwindcss/pull/11709))
|
||||
- Make `content` optional for presets in TypeScript types ([#11730](https://github.com/tailwindlabs/tailwindcss/pull/11730))
|
||||
- Handle variable colors that have variable fallback values ([#12049](https://github.com/tailwindlabs/tailwindcss/pull/12049))
|
||||
|
||||
## [3.3.3] - 2023-07-13
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i
|
||||
let VALUE = /(?:\d+|\d*\.\d+)%?/
|
||||
let SEP = /(?:\s*,\s*|\s+)/
|
||||
let ALPHA_SEP = /\s*[,/]\s*/
|
||||
let CUSTOM_PROPERTY = /var\(--(?:[^ )]*?)\)/
|
||||
let CUSTOM_PROPERTY = /var\(--(?:[^ )]*?)(?:,(?:[^ )]*?|var\(--[^ )]*?\)))?\)/
|
||||
|
||||
let RGB = new RegExp(
|
||||
`^(rgba?)\\(\\s*(${VALUE.source}|${CUSTOM_PROPERTY.source})(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${ALPHA_SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?\\s*\\)$`
|
||||
|
||||
@ -1113,3 +1113,21 @@ crosscheck(({ stable, oxide }) => {
|
||||
`)
|
||||
})
|
||||
})
|
||||
|
||||
it('variables with variable fallback values can use opacity modifier', async () => {
|
||||
let config = {
|
||||
content: [
|
||||
{
|
||||
raw: html`<div class="bg-[rgb(var(--some-var,var(--some-other-var)))]/50"></div>`,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
let result = await run(`@tailwind utilities;`, config)
|
||||
|
||||
expect(result.css).toMatchFormattedCss(css`
|
||||
.bg-\[rgb\(var\(--some-var\,var\(--some-other-var\)\)\)\]\/50 {
|
||||
background-color: rgb(var(--some-var, var(--some-other-var)) / 0.5);
|
||||
}
|
||||
`)
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user