Repository navigation
[v4] Regression: Media queries inside @apply not working as expected compared to v3 #18520
|
What version of Tailwind CSS are you using? v4.1.11 What build tool (or framework if it abstracts the build tool) are you using? Angualr Materail - NG20 What version of Node.js are you using? v20.19.0 What browser are you using? Chrome What operating system are you using? macOS Reproduction URL Describe your issue In Tailwind CSS v4, applying utility classes using In particular, combining Example SCSS Code Illustrating the Problem:@use '@angular/material' as mat;
@reference 'tailwindcss';
:host {
::ng-deep {
.task-list {
@include mat.form-field-density(-1);
@apply hover:md:bg-red-500; // ❌ Not working in v4, worked in v3
&:hover {
@apply md:bg-red-500; // ❌ Not working in v4, worked in v3
}
.mdc-label {
@apply font-medium text-red-500; // ✅ Still works
}
.mat-mdc-checkbox-checked {
@apply pointer-events-none opacity-50;
.mdc-label {
@apply line-through!; // ✅ Still works
}
}
.action-trigger {
@apply md:opacity-0; // ❌ Not working as it did in v3 — no longer hidden on large screens
}
}
}
}These patterns are used widely across our large Angular application, and after the v4 upgrade, many component styles have silently broken. While base utilities like ImpactThis is a critical issue for us:
Please confirm:
Any guidance or fix would be hugely appreciated. We're happy to provide further context or contribute to a fix if this is unintended. Thank you! |
Replies: 2 comments 15 replies
|
As per the documentation:
|


You can try in
.postcssrc.json:{ "plugins": { "@tailwindcss/postcss": { "optimize": true } } }