I know there are several tools out there that are capable of obfuscating JavaScript files such as by turning a simple functions like:
function testing()
{
var testing;
var testing2;
alert(testing+testing2);
}
into
function a(var a,b;alert(a+b);)
My question is does something like this exist for use with CSS/HTML (or is there a tool that has a similar effect)? In particular, a minification/obfuscation tool that actually renames variables and refereneces and eliminates additional white-space etc.
And if so – would the benefits in performance outweigh the readability in both CSS/HTML/JavaScript minification/obfuscation?
It is very difficult to ‘minify’ HTML or CSS because all that can safely be saved is white space (which doesn’t amount to a huge saving). As for class renaming, you loose an important part of the web which is having semantic code (which represents meaning). I think the best option is to ensure that you have gzip compression enabled on your web server and focus on combining your assets into a single file wherever possible.