3 ms·
This. The secret super power in Tailwind is editing the tailwind.config.js and forcing standards. Then you have have something like only having four padding opt
by agloeregrets 4y ago
This. The secret super power in Tailwind is editing the tailwind.config.js and forcing standards. Then you have have something like only having four padding options per your style guide and them defined in one specific place. In style tags you could use a CSS var for this as well but you better hope you used it everywhere. Plus, that becomes super wordy: 'padding-left: var(--padding-1)' vs 'pl-1'
- toastal 4y agoAre the folks that hate single char variable names here to chime in?
- agloeregrets 4y agoOh I'm one of them..but incredibly clear shorthand is helpful for these kinds of cases. Writing code like `const a = 5; b = a/2; c = a/b` is pretty nonsensical. but in tailwind these things have meanings: p = padding, m = margin, then you have left, right top, bottom, (l r t b) and then X and Y. (so pl- mx- pb-) That is all of them. At the rate you use them it is pretty clear I guess.
- necovek 4y agoIsn't this ("forcing standards") the usual property of using CSS classes (responsibly)?