Feat: Optionally allow and generate Random classnames for Production Build #10593
Replies: 15 comments 13 replies
-
This will be great for secure code |
Beta Was this translation helpful? Give feedback.
-
This is a great idea hope the team looks into it |
Beta Was this translation helpful? Give feedback.
-
This is one of the things I'd also like Tailwind to include. |
Beta Was this translation helpful? Give feedback.
-
Thank you guys for the upvotes, I think that this feature will help us to make less people copy our production code (component copy paste) Example: anybody who is using tailwind css can currently copy my component or scrape my page altogether and just add it in it's project which is so wrong ethically and also as copyright. This shouldn't be happening and we need to do something about it and this feature request according to me makes sense, I rest my case and will let @adamwathan @tailwindlabs decide 😃 |
Beta Was this translation helpful? Give feedback.
-
I think this is not only for copy/past. I'm building a lib with tailwind and during the build time I discovery that I need to add prefix on tailwind otherwise if the consumer has tailwind too it will override my lib's css, now I have to redo all my classes because prefix affect dev too. |
Beta Was this translation helpful? Give feedback.
-
This is something that should probably be a PostCSS plugin, not implemented in Tailwind directly. There's https://www.npmjs.com/package/postcss-obfuscator?activeTab=readme, but I haven't tried it. |
Beta Was this translation helpful? Give feedback.
-
n4j1Br4ch1D/postcss-obfuscator#15 For those who are looking for an alternative here in this thread, leave a temporary solution |
Beta Was this translation helpful? Give feedback.
-
Hey guys! Any new alternative for generating these random classes? |
Beta Was this translation helpful? Give feedback.
-
I made something to solve this issue, although is kinda new and raw, I'm sure will get better and more firm with time, presenting, RANTAIL |
Beta Was this translation helpful? Give feedback.
-
Hi there, any updates please? Maybe it is something which can be included in v4? |
Beta Was this translation helpful? Give feedback.
-
I'd like to know as well. Are there any updates? |
Beta Was this translation helpful? Give feedback.
-
very good idea |
Beta Was this translation helpful? Give feedback.
-
this is really helpful in case of some injected scripts for plugins that can overwrite the website css accidentally e.g contact center chats, lead forms ... |
Beta Was this translation helpful? Give feedback.
-
TailwindUI does this to "protect" their components https://tailwindui.com/components/ecommerce/components/order-history so the workflow exists. |
Beta Was this translation helpful? Give feedback.
-
Can't we have this Optional Feature: Allow and Generate Random classnames for Production Build
In Development we have the usual
whereas in Production build can't we have like this?
Basically,
text-sm
becomesykfxtnjih53x
and so on...By the way,
If prefix configuration added
then
becomes
Tool to generate random classNames: https://github.com/paralleldrive/cuid2 by @ericelliott
Code Suggestion to generate Random Classnames to replace with explicit css Classnames, handles guaranteed uniqueness with Set besides being quite Collision resistant already.
Inspiration:
~ @adamwathan https://twitter.com/adamwathan/status/1613719057014063104
Beta Was this translation helpful? Give feedback.
All reactions