In current project, I was asked for compressing the HTML class attribute and corresponding CSS selectors before deployment. For example, the code on
There is also a project called "rename-css-selectors" if you handle the code with node:
https://www.npmjs.com/package/rename-css-selectors
There are plugins for nearly every build tool (webpack, parcel, gulp, ...):
https://github.com/JPeer264/node-rcs-core#plugins
This will minify all CSS selectors in HTML, JS and CSS files (actually any file you want). I saved 20ish% of the CSS filesize at the end.