Update @apply docs to be explicit about preprocessor features

This commit is contained in:
Adam Wathan 2017-11-04 12:04:45 -04:00
parent 4b345d66f9
commit d1764b3fab

View File

@ -46,17 +46,32 @@ This is extremely useful when you find a common utility pattern in your HTML tha
}
```
Note that `@@apply` **will not work** for mixing in hover or responsive variants of another utility. Instead, mixin the plain version of that utility into the `:hover` pseudo-selector or a new media query:
Note that `@@apply` **will not work** for mixing in hover or responsive variants of another utility. Instead, mix in the plain version of that utility into the `:hover` pseudo-selector or a new media query:
```less
// Won't work:
.btn {
@@apply .block .bg-red;
@@apply .md:inline-block;
@@apply .hover:bg-blue;
}
// Do this instead:
.btn {
@@apply .block .bg-red;
}
.btn:hover {
@@apply .bg-blue;
}
@@screen md {
.btn {
@@apply .inline-block;
}
}
// Or if you're using Less or Sass:
.btn {
@@apply .block .bg-red;
&:hover {
@@apply .bg-blue;
}