Skip to content

Understanding circular dependency failure with @apply #8595

Answered by rohmann
Poimen asked this question in Help
Discussion options

You must be logged in to vote

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):

.cursor-pointer.target {
  cursor: pointer
}

.target {
  @apply cursor-pointer;
}

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:

let intersects = parentClasses.some((selector) => nodeClasses.includes(s…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Poimen
Comment options

@adamwathan
Comment options

@Poimen
Comment options

Answer selected by Poimen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants