feature proposal : alias for a group of classes #3344
Replies: 4 comments 1 reply
-
I think you can do the very same with .custom-div {
@apply tailwind-classes
} <div className="custom-div">
...
</div> |
Beta Was this translation helpful? Give feedback.
-
My bad, I didn't know @apply existed. It's exactly what I needed and more! Thanks ;) |
Beta Was this translation helpful? Give feedback.
-
There are some different of my 「alias」. @apply caseInput.custom-div {
@apply w-full flex ...
} <div class="custom-div"><div> Output.custom-div {
width: 100%;
display: flex;
...
} My alias caseInput// tailwind config
{
alias: {"custom-div": "w-full flex ..."}
} <div class="custom-div"><div> Output.w-full {
width: 100%;
}
.flex {
display: flex;
}
... <div class="w-full flex ..."><div>
|
Beta Was this translation helpful? Give feedback.
-
Hi @baira @vovayatsyuk @vovayatsyuk @adamwathan Since everybody curse "apply" nowadays, do you know about any tools/solutions which has been created in the tailwind community to solve this issue? The alias feature by @baira makes a lot of sence. |
Beta Was this translation helpful? Give feedback.
-
Hello guys, fantastic work!
Sometimes you end up reusing the same sequence of classes across your UI for divs or buttons for example. Reusable components can help but you may end up reusing the same set of classes across the reusable components too.
My proposition is to define your
aliases
insidetheme
like this :and inside your code do use it like this :
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions