Skip to content

@apply inheritance, is this expected? #14641

Answered by adamwathan
phegman asked this question in Help
Discussion options

You must be logged in to vote

Hey! Yeah this is expected although we are changing this in v4 to be closer to your original expectations I think.

Here's a previous write-up that explains it:

#10660 (comment)

TL;DR you've extended the definition of truncate, so @apply truncate needs to include that behavior.

Say you had this HTML before:

<div class="nested">
  <div class="truncate bg-red-500">
    ...
  </div
</div>

The idea with @apply is you are supposed to be able to extract some classes and have the behavior not change, so you want to be able to do this:

<div class="nested">
  <div class="my-class">
    ...
  </div
</div>
.my-class {
  @apply truncate bg-red-500;
}

The only way for that to actually work is to do wha…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@phegman
Comment options

@phegman
Comment options

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