Obfuscating Tailwind CSS Class Names in Production #14899
Replies: 2 comments 1 reply
-
| 
         Why? You will always be able to recover the class name from the styles applied by the selector. Also, reverse engineering CSS? Who would do that?  | 
  
Beta Was this translation helpful? Give feedback.
-
        
 What exactly is the problem you're having? There's no security issue there. The only one you really put forth that might be worth consideration, is one of performance, less data having to be sent. That is a valid goal and objective worth chasing IF you're doing a lot of traffic, which I highly doubt you're doing so much that saving a kilobyte of data per request is going to save you millions of dollars across the board (ala Google).  | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm looking for a way to obfuscate or encrypt class names in production when using Tailwind CSS. Given the utility-first approach of Tailwind, the class names can sometimes reveal a lot about the styling structure, which may not always be ideal in a production environment.
Has anyone successfully implemented a method for shortening or encrypting these class names to make the code more compact and potentially harder to reverse-engineer? I’m open to suggestions or best practices on how to set this up effectively without compromising build performance or compatibility. Any tips or tools that work well with Tailwind's setup?
Beta Was this translation helpful? Give feedback.
All reactions