@apply
inheritance, is this expected?
#14641
-
I am seeing some inheritance with Here is the input and output of the example Input.foobar {
@apply truncate;
}
.nested .truncate {
color: green;
} Output.truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.foobar {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.nested .foobar {
color: green;
}
.nested .truncate {
color: green;
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
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: TL;DR you've extended the definition of Say you had this HTML before: <div class="nested">
<div class="truncate bg-red-500">
...
</div
</div> The idea with <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 what we do now in v3, otherwise given your example the text color would change when you extract |
Beta Was this translation helpful? Give feedback.
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:
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:The only way for that to actually work is to do wha…