Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

is there any way to obfuscate the classes in the production build? #456

Open
vesper8 opened this issue Feb 17, 2020 · 3 comments
Open

is there any way to obfuscate the classes in the production build? #456

vesper8 opened this issue Feb 17, 2020 · 3 comments

Comments

@vesper8
Copy link

vesper8 commented Feb 17, 2020

since one of the side-effects of using tailwind is that styles are usually much easier to rip/steal, especially so if @apply is not used and every class is truly inline, I thought this would have prompted someone to create some kind of obfuscator which replaces all the vanilla tailwind classes by short unintelligible hashes, with matching classes in the bundle of course so it all still works

of course, this could be reversed with a fair amount of effort, but I could still see this as being quite useful at almost no performance cost.. perhaps slightly heavier bundles because of slightly more characters in the classes. Still, I would use that if it existed

This would also be useful if you are selling templates built with Tailwind CSS and want to provide a live demo

@adamwathan
Copy link
Member

First tool I'd try is this one:

https://github.com/posthtml/posthtml-minify-classnames

@vesper8
Copy link
Author

vesper8 commented Feb 17, 2020

thank you, I'm having a look, at first glance it seems this isn't easy to use or compatible with bundles created through Webpack though.. but it's a step in the right direction!

I think this would be pretty useful to cover to protect the templates in your upcoming Tailwind UI product

@vesper8
Copy link
Author

vesper8 commented Feb 17, 2020

I just dug around a bit and found this https://github.com/sndyuk/mangle-css-class-webpack-plugin which I'm currently testing and having very good results with.. seems very promising

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants