-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
What version of Tailwind CSS are you using?
For example: v3.1.8
What build tool (or framework if it abstracts the build tool) are you using?
Tailwind Play
What browser are you using?
Chrome
What operating system are you using?
macOS
Reproduction URL
https://play.tailwindcss.com/Gd9jsdpkCi?file=css
Describe your issue
When applying custom components to selectors with a sibling operator, the output CSS does not apply to them properly. For example, with the following code
@layer components {
.row.row-odd {
@apply bg-green-400;
}
.row.row-even {
@apply bg-red-400;
}
.row-odd + .row-even {
@apply bg-blue-400;
}
.row-even + .row-odd {
@apply bg-yellow-400;
}
}
section:nth-of-type(odd) { @apply row row-odd; }
section:nth-of-type(even) { @apply row row-even; }
...should output something similar to:
section:nth-of-type(odd) + section:nth-of-type(even) { background: blue; }
section:nth-of-type(even) + section:nth-of-type(odd) { background: yellow; }
...and yet it only outputs:
section:nth-of-type(odd) + .row-even { background: blue; }
.row-odd + .section:nth-of-type(even) { background: blue; }
section:nth-of-type(even) + .row-odd { background: yellow; }
.row-even + section:nth-of-type(odd) { background: yellow; }
It also seems that when declaring composite rules (multiple classes, such as .row.row-odd
) this breaks during compilation when applying it to a tag instead of a class, resulting in rules such as .rowsection
(with no separator, which makes no sense) as a result of the following code:
@layer components {
.row.row-odd {
@apply bg-green-400;
}
}
section {
@apply row-odd;
}
Both behaviors are observable in the output of the Tailwind Play document I linked