Skip to content

Commit

Permalink
Fix use of falsy values in theme config
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed Jan 5, 2022
1 parent fc6c27d commit dc8f3f0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/pluginUtils.js
Expand Up @@ -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 []
Expand Down
28 changes: 28 additions & 0 deletions tests/basic-usage.test.js
Expand Up @@ -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;
}
`)
})
})

0 comments on commit dc8f3f0

Please sign in to comment.