I tried out the online JS Minifier but it cuts out conditional comments like:
var u = navigator.userAgent;var e=/*@cc_on!@*/false;
BECOMES
var u=navigator.userAgent;var e=false;
This would affect the operation of the code, so instead of manually adding the stripped out comments manually, I’m looking for a minifier that intelligently preserves these and any such comments.
YUICompressor reportedly does the needful. Here is an excerpt from a blog:
…
But fret not, it’s not as bad as you think. Unfortunately, JSMin removes conditional compilation comments, but I believe this is due to not having been updated in a while, and not up to speed with modern web development practices.
Using other tools such as YUI compressor or packer does indeed work fine with conditional compilation.
…
You can read the entire post at http://robertnyman.com/2008/05/26/conditional-compilation-in-javascript/