Skip to content

Commit 9945f60

Browse files
committed
Fix use of falsy values in theme config
1 parent fc6c27d commit 9945f60

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ 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+
- Allow use of falsy values in theme config ([#6917](https://github.com/tailwindlabs/tailwindcss/pull/6917))
13+
1114

1215
## [3.0.11] - 2022-01-05
1316

src/util/pluginUtils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export function coerceValue(types, modifier, options, tailwindConfig) {
185185
// Find first matching type
186186
for (let type of [].concat(types)) {
187187
let result = typeMap[type](modifier, options, { tailwindConfig })
188-
if (result) return [result, type]
188+
if (result !== undefined) return [result, type]
189189
}
190190

191191
return []

tests/basic-usage.test.js

+28
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,31 @@ test('per-plugin colors with the same key can differ when using a custom colors
109109
`)
110110
})
111111
})
112+
113+
it('fasly config values still work', () => {
114+
let config = {
115+
content: [{ raw: html`<div class="inset-0"></div>` }],
116+
theme: {
117+
inset: {
118+
0: 0,
119+
},
120+
},
121+
plugins: [],
122+
corePlugins: { preflight: false },
123+
}
124+
125+
let input = css`
126+
@tailwind utilities;
127+
`
128+
129+
return run(input, config).then((result) => {
130+
expect(result.css).toMatchFormattedCss(css`
131+
.inset-0 {
132+
top: 0;
133+
right: 0;
134+
bottom: 0;
135+
left: 0;
136+
}
137+
`)
138+
})
139+
})

0 commit comments

Comments
 (0)