3 ms·
OK, this: <div class="lg:flex lg:items-center lg:justify-between">` Isn't this why we have CSS preprocessors? So we can do: <div class="description-of-what-t
by wwweston 7y ago
OK, this:
<div class="lg:flex lg:items-center lg:justify-between">`
Isn't this why we have CSS preprocessors? So we can do:
<div class="description-of-what-this-is">
.description-of-what-this-is {
.lg_flex()
.lg_items-center()
.lg_justify_between();
}
Assuming there's enough complexity beneath the mixins to justify their use -- some of these might just be CSS properties.
- Ligrev 7y agoThat assumes you have the means, the knowledge, and the time, to go through a build step. What you find to be clean code might go the opposite way for someone (i.e. why would I use scss if utils are all I need?). You might work with large scale apps where BEM may make more sense. You might work on a site builder where utils might be better. You might be creating splash pages for marketing purposes where going for element selectors may be enough.
- mcbetz 7y agoYou can do this with Tailwind as well: https://tailwindcss.com/docs/extracting-components https://tailwindcss.com/docs/extracting-components // in JS, then build .btn-blue { @apply bg-blue-500 text-white font-bold py-2 px-4 rounded; }
- terenceng2010 7y agoThis feature makes it a very progressive library for various stages of development. Inline earlier, then gradually extracting the style for reuse in later stage. Besides, their documentation is really good for one to learn those newer css concept.
- SahAssar 7y agoIn that secenario why even use tailwind? Why not just normal css?
- ahallock 7y agoJust use view templates to capture this if you need to reuse.