-
We mostly work with web components using the StencilJS framework, which we have integrated Tailwind into (version 3.1.2). On some occasions we find that tailwind reports a circular dependency when using In the examples below, I have reduced the html/css to make it fit 👍 In the example we have a web component ( render() {
const { isDisabled } = this;
return (
<Host>
<omds-input-field-wrapper
class={{
'cursor-pointer': true,
'cursor-auto pointer-events-none': isDisabled,
}}
/>
</Host>
);
} In order to affect some styling in the component omds-input-field-wrapper::part(input-field) {
@apply cursor-pointer;
}
omds-input-field-wrapper:not(.is-open)::part(input-field) {
@apply cursor-pointer;
} When the Stencil compiler runs, it generates a bunch of css (I have removed all the functional css and left the errant css): @tailwind base;
@tailwind components;
@tailwind utilities;
/*!@omds-input-field-wrapper::part(input-field)*/
omds-input-field-wrapper.sc-omds-dropdown-field::part(input-field) {
@apply cursor-pointer;
}
/*!@omds-input-field-wrapper:not(.is-open)::part(input-field)*/
omds-input-field-wrapper.sc-omds-dropdown-field:not(.is-open)::part(input-field) {
@apply cursor-pointer;
}
/*!@.cursor-pointer*/
.cursor-pointer.sc-omds-dropdown-field {
cursor: pointer
} Here, the inline html classes have been created, and the If you run this through the tailwind cli, it generates the error:
In this case it is pretty simple to revert to normal css, but I'm trying to understand the circular dependency reason. If I remove: .cursor-pointer.sc-omds-dropdown-field {
cursor: pointer
} then all works fine. Is there any reason why Tailwind throws a circular dependency for this? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
So a circular dependency would be using
The circularity error is triggered simply by checking if the selectors contain each other somehow. Because tailwindcss/src/lib/expandApplyAtRules.js Line 419 in 96a8353 I'm not overly familiar with Stencil but perhaps it would help of tailwind processed the CSS first, then Stencil ran afterwards to expand their selectors. |
Beta Was this translation helpful? Give feedback.
So a circular dependency would be using
@apply cursor-pointer
in a block with a selector that is also attached to what is being applied like this (https://play.tailwindcss.com/rZSdTtLrto?file=css):The circularity error is triggered simply by checking if the selectors contain each other somehow. Because
@apply cursor-pointer
is inside.target
it doesn't allow connected those selectors like.cursor-pointer.target
You can see that logic happening in Tailwind here:tailwindcss/src/lib/expandApplyAtRules.js
Line 419 in 96a8353