mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Support passing empty object to signal 'use default config path'
This commit is contained in:
parent
649fb8f21e
commit
5cad3910fd
@ -133,3 +133,42 @@ test('tailwind.config.js is picked up by default', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('tailwind.config.js is picked up by default when passing an empty object', () => {
|
||||
return inTempDirectory(() => {
|
||||
fs.writeFileSync(
|
||||
path.resolve(defaultConfigFile),
|
||||
`module.exports = {
|
||||
theme: {
|
||||
screens: {
|
||||
mobile: '400px',
|
||||
},
|
||||
},
|
||||
}`
|
||||
)
|
||||
|
||||
return postcss([tailwind({})])
|
||||
.process(
|
||||
`
|
||||
@responsive {
|
||||
.foo {
|
||||
color: blue;
|
||||
}
|
||||
}
|
||||
`,
|
||||
{ from: undefined }
|
||||
)
|
||||
.then(result => {
|
||||
expect(result.css).toMatchCss(`
|
||||
.foo {
|
||||
color: blue;
|
||||
}
|
||||
@media (min-width: 400px) {
|
||||
.mobile\\:foo {
|
||||
color: blue;
|
||||
}
|
||||
}
|
||||
`)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -13,7 +13,7 @@ import { defaultConfigFile } from './constants'
|
||||
import defaultConfig from '../stubs/defaultConfig.stub.js'
|
||||
|
||||
function resolveConfigPath(filePath) {
|
||||
if (_.isObject(filePath) && !_.has(filePath, 'config')) {
|
||||
if (_.isObject(filePath) && !_.has(filePath, 'config') && !_.isEmpty(filePath)) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ function resolveConfigPath(filePath) {
|
||||
return path.resolve(filePath.config)
|
||||
}
|
||||
|
||||
if (!_.isUndefined(filePath)) {
|
||||
if (_.isString(filePath)) {
|
||||
return path.resolve(filePath)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user