Let's consider the following example:
<div class="text-xs text-slate-600 uppercase font-bold tracking-wider">Text</div>
I have this div so defined, subsequently in other parts of code I use the same classes.
Is there a way to define the name of a class, which contains all the classes?
For example pseudocode:
.myComponentName {
use .text-xs
use .text-slate-600
use .uppercase
use .font-bold
use .tracking-wider
}
For example in react js I could define a component and solve the problem.
function myComponentName(text) {
return <div class="text-xs text-slate-600 uppercase font-bold tracking-wider">{text}</div>
}
But I was wondering are there other solutions?
I was reading about this, it could be the solution: https://tailwindcss.com/docs/reusing-styles#extracting-classes-with-apply