Fix use of falsy values in theme config (#6917)

This commit is contained in:
Jordan Pittman 2022-01-05 16:37:07 -05:00 • committed by GitHub
parent fc6c27d95b
commit 82f163d425
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 2 deletions

View file

@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
- Nothing yet!
### Fixed
- Allow use of falsy values in theme config ([#6917](https://github.com/tailwindlabs/tailwindcss/pull/6917))
## [3.0.11] - 2022-01-05

View file

@ -185,7 +185,7 @@ export function coerceValue(types, modifier, options, tailwindConfig) {
// Find first matching type
for (let type of [].concat(types)) {
let result = typeMap[type](modifier, options, { tailwindConfig })
if (result) return [result, type]
if (result !== undefined) return [result, type]
}
return []

View file

@ -109,3 +109,31 @@ test('per-plugin colors with the same key can differ when using a custom colors
`)
})
})
it('fasly config values still work', () => {
let config = {
content: [{ raw: html`<div class="inset-0"></div>` }],
theme: {
inset: {
0: 0,
},
},
plugins: [],
corePlugins: { preflight: false },
}
let input = css`
@tailwind utilities;
`
return run(input, config).then((result) => {
expect(result.css).toMatchFormattedCss(css`
.inset-0 {
top: 0;
right: 0;
bottom: 0;
left: 0;
}
`)
})
})