tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

Obfuscate Tailwind CSS classes

Open hmaesta opened this issue 5 years ago • 13 comments

For performance proposes, everything that can be made to improve final bundle size is welcome. Even better if automated.

As feature request, would be nice to obfuscate classes on production bundle. Using webpack-obfuscator, for example.

Example

Original code:

# index.vue
<div class="text-gray-500">Hey!</div>

# tailwind.css
.text-gray-500 { color: #888; }

Final code:

# index.html
<div class="a">Hey!</div>

# tailwind.css
.a { color: #888; }

hmaesta avatar Dec 30 '20 15:12 hmaesta

If you want to experiment it, please go ahead :)

I don't know the side effects regarding Tailwindcss purge option.

atinux avatar Jan 08 '21 16:01 atinux

Would love this. Someone mentioned that this could work? I haven't tried it: https://github.com/sndyuk/mangle-css-class-webpack-plugin

684efs3 avatar Feb 25 '21 00:02 684efs3

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 30 '21 03:07 stale[bot]

Not stale

atinux avatar Aug 02 '21 14:08 atinux

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 02 '21 01:10 stale[bot]

not stale

gekkedev avatar Jan 12 '22 19:01 gekkedev

Anyone managed to do this?

nephix avatar Jun 24 '22 00:06 nephix

Any news? I tried mangle-css-class-webpack-plugin, but it doesn't work for me

gggglglglg avatar Sep 12 '22 16:09 gggglglglg

Up

thienna avatar Jan 05 '23 07:01 thienna

up

estige avatar May 29 '23 22:05 estige

Reopened issue but it could take a while to solve this. PR is more than welcome. 🙂

ineshbose avatar May 30 '23 08:05 ineshbose

Has anyone taken a look at tailwindcss-mangle yet?

ineshbose avatar Jan 18 '24 16:01 ineshbose

is webpack works with vite? or nuxt?

JenuelDev avatar Apr 09 '24 01:04 JenuelDev