mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Ensure nesting plugins can receive options (#7016)
* fix: options for nesting / nested plugins * add tests to ensure passing options to postcss plugin works Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
This commit is contained in:
parent
bef3838552
commit
8293c2d33d
@ -14,7 +14,10 @@ module.exports = function nesting(opts = postcssNested) {
|
||||
})
|
||||
|
||||
let plugin = (() => {
|
||||
if (typeof opts === 'function') {
|
||||
if (
|
||||
typeof opts === 'function' ||
|
||||
(typeof opts === 'object' && opts?.hasOwnProperty('postcssPlugin'))
|
||||
) {
|
||||
return opts
|
||||
}
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ it('should default to the bundled postcss-nested plugin (no options)', async ()
|
||||
`)
|
||||
})
|
||||
|
||||
it('should default to the bundled postcss-nested plugin (empty ooptions)', async () => {
|
||||
it('should default to the bundled postcss-nested plugin (empty options)', async () => {
|
||||
let input = css`
|
||||
.foo {
|
||||
color: black;
|
||||
@ -97,6 +97,29 @@ it('should default to the bundled postcss-nested plugin (empty ooptions)', async
|
||||
`)
|
||||
})
|
||||
|
||||
it('should be possible to use postcss-nested plugin with options', async () => {
|
||||
let input = css`
|
||||
.foo {
|
||||
color: black;
|
||||
@screen md {
|
||||
color: blue;
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
expect(await run(input, postcssNested({ noIsPseudoSelector: true }))).toMatchCss(css`
|
||||
.foo {
|
||||
color: black;
|
||||
}
|
||||
|
||||
@media screen(md) {
|
||||
.foo {
|
||||
color: blue;
|
||||
}
|
||||
}
|
||||
`)
|
||||
})
|
||||
|
||||
test('@screen rules are replaced with media queries', async () => {
|
||||
let input = css`
|
||||
.foo {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user