3 ms·
> Tailwind would be a lot more appealing to me if it was coupled with some system where I could say "class X inherits from tailwind classes A, B and C" How is
by e12e 3y ago
> Tailwind would be a lot more appealing to me if it was coupled with some system where I could say "class X inherits from tailwind classes A, B and C"
How is that different from:
D {
@apply A B C;
}
Or creating a new utility?
https://tailwindcss.com/docs/adding-custom-styles#using-modifiers-with-custom-css https://tailwindcss.com/docs/adding-custom-styles#using-modi...
- threatofrain 3y agoNote that the Tailwind team strongly anti-recommends @apply and regrets ever putting it in there. As for creating utility classes, well, those are still utility classes. If you do semantic classes then you are fighting against the philosophy of Tailwind as detailed in the Refactoring UI book.
- mhitza 3y ago> Note that the Tailwind team strongly anti-recommends @apply and regrets ever putting it in there Please link to something that supports this claim, because it's not the first time I've seen it made on HN, but only found it on HN
- e12e 3y agoI think "regrets putting it in there" is a bit strong - I'd be interested in a quote. That said, the documentation does lean heavily away from @apply: https://tailwindcss.com/docs/reusing-styles#extracting-classes-with-apply https://tailwindcss.com/docs/reusing-styles#extracting-class... > If you’re going to use @apply, use it for very small, highly reusable things like buttons and form controls — and even then only if you’re not using a framework like React where a component would be a better choice. Personally I think @apply is a useful tool - and I'm not sold on it being always evil.
- henbruas 3y agoIt's accurate. Here you go: https://twitter.com/adamwathan/status/1559250403547652097?lang=en https://twitter.com/adamwathan/status/1559250403547652097?la... https://twitter.com/adamwathan/status/1226511611592085504?lang=en https://twitter.com/adamwathan/status/1226511611592085504?la... https://twitter.com/adamwathan/status/1296770370209566720?lang=en https://twitter.com/adamwathan/status/1296770370209566720?la...
- Karellen 3y agoThe most authoritative form of documentation that part of a system is considered a serious design flaw and should not be used in new code, is on xitter? I'm sure new users of the system will find that. Great job everyone. FFS
- ReleaseCandidat 3y agoThere is a Twitter post saying putting it in was a mistaken and that he wouldn't do it again. https://twitter.com/adamwathan/status/1559250403547652097 https://twitter.com/adamwathan/status/1559250403547652097