Skip to content

Commit 78fb761

Browse files
Preserve case of css variables added by plugins (#6888)
1 parent 30ea5b1 commit 78fb761

File tree

5 files changed

+50
-14
lines changed

5 files changed

+50
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- Nothing yet!
10+
### Fixed
11+
12+
- Preserve case of css variables added by plugins ([#6888](https://github.com/tailwindlabs/tailwindcss/pull/6888))
1113

1214
## [3.0.10] - 2022-01-04
1315

package-lock.json

Lines changed: 13 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"is-glob": "^4.0.3",
8080
"normalize-path": "^3.0.0",
8181
"object-hash": "^2.2.0",
82-
"postcss-js": "^3.0.3",
82+
"postcss-js": "^4.0.0",
8383
"postcss-load-config": "^3.1.0",
8484
"postcss-nested": "5.0.6",
8585
"postcss-selector-parser": "^6.0.7",

tests/custom-plugins.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,3 +1892,22 @@ test('animation values are joined when retrieved using the theme function', () =
18921892
`)
18931893
})
18941894
})
1895+
1896+
test('custom properties are not converted to kebab-case when added to base layer', () => {
1897+
let config = {
1898+
content: [],
1899+
plugins: [
1900+
function ({ addBase }) {
1901+
addBase({
1902+
':root': {
1903+
'--colors-primaryThing-500': '0, 0, 255',
1904+
},
1905+
})
1906+
},
1907+
],
1908+
}
1909+
1910+
return run('@tailwind base', config).then((result) => {
1911+
expect(result.css).toContain(`--colors-primaryThing-500: 0, 0, 255;`)
1912+
})
1913+
})

tests/parseObjectStyles.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,17 @@ test('it can parse an array of styles', () => {
300300
}
301301
`)
302302
})
303+
304+
test('custom properties preserve their case', () => {
305+
const result = parseObjectStyles({
306+
':root': {
307+
'--colors-aColor-500': '0',
308+
},
309+
})
310+
311+
expect(css(result)).toMatchCss(`
312+
:root {
313+
--colors-aColor-500: 0;
314+
}
315+
`)
316+
})

0 commit comments

Comments
 (0)