DEV Community

Discussion on: Why I moved from Styled Components to (S)CSS modules

Collapse
 
boris1988 profile image
Boris

Why not use TailwindCSS with JIT compilation mode ? You write all styles inside component and final size of the css bundle is minimal

Collapse
 
puruvj profile image
PuruVJ

Well, a few points here:

  1. I like to keep my HTML and CSS separate, as in not fill it up with huge class names and all
  2. JIT wasn't there when I wrote this article 😋
  3. This project's theming heavily relies on CSS variables, so having some styles as Tailwind classes in Html and rest of css vars theming stuff in the actual CSS would've been really bad for peace of mind
Collapse
 
boris1988 profile image
Boris

I'm asking what will you use if you will start a new project ? Tailwind has Intellisense class sorting plugins, this makes actual writing of text much shorter. You just type 1-2 letters and ther press TAB or use arrows to choose. Also it is much easier for other people to edit your code, they don't need to understand the whole structure of styles, everything is global.

Thread Thread
 
puruvj profile image
PuruVJ

I would still go for plain CSS Modules, because I use CSS vars extensively, and having some styles inline, and the variables styles in a stylesheet wouldn't be smart

Thread Thread
 
boris1988 profile image
Boris

I think if you try Tailwind in a big project, you will realize soon that it saves a lot of time that you don't need to switch between files. All styling inside component and no need for additional files

Thread Thread
 
puruvj profile image
PuruVJ

Oh I have used Tailwind on some medium sized projects. Coming back to Styled Components and now plain CSS once again is the next in progression.