Replies: 1 comment 2 replies
-
|
You could have an intermediary @utility foo {
…
}
.class1 {
@apply foo;
}
.class2 {
@apply text-xs;
span {
@apply foo;
}
}That being said, Adam Wathan (creator of Tailwind) does seem to advocate avoiding
So the optimal solution in the Tailwind paradigm would be to avoid classes altogether and use your templating engine (if you have one) to split common patterns into components: Before<div className="class1">…</div>
<div className="class2"><span>…</span></div>Afterconst Foo = ({ children }) => <span className="…">{children}</span>;
<Foo>…</Foo>
<div><Foo>…</Foo></div> |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In
.class1and.class2 spanare duplicated group of classes and they all use@apply. I can get rid of duplicating with selector.class1, .class2 spanbut can I keep the nested structure? Does tailwind have something to set a variable that has the group of classes and put it inside both places?Beta Was this translation helpful? Give feedback.
All reactions