DEV Community

[Comment from a deleted post]
Collapse
 
starptech profile image
Dustin Deus

You didn't understand the idea of a utility framework like tailwind. It doesn't replace CSS-modules, CSS-in-JS, BEM, or any other methodology. Over time it's a blessing to work with because you write much fewer custom selectors. This results in a standardized way of how base styles (font, grid, margin, padding, color) are applied to your components. This makes your components more readable and maintainable.

You code can also be written as:

<style>
  .chat-notification {
    @apply font-bold py-2 px-4 rounded;
    // .......
  }
  .logo-wrapper {
    @apply flex-shrink-0;
  }
  // ........

  // component specific code
  .logo {
    height: 3rem;
    width: 3rem;
  }
</style>
Enter fullscreen mode Exit fullscreen mode
Collapse
 
kilianso profile image
kilianso

But if you write it this way, would that inline the classes anyway in the output or not? And what about purge? Would it still work this way removing unused stuff without having the classes applied to the HTML directly?