I did some brief looking around and word on the internets is that the YUI compressor is one of the better compressors out there. The YUI compressor is an open source java applet. This *should* work with Mapguide Open, heck this might even be done already in MGOS – but I am only using Enterprise so I cannot confirm, deny, or test this.
Some of the key things the compressor will do:
- remove all comments
- remove all white space and line breaks
- rename all local variables and parameters to single characters
The YUI compressor should not alter variable values or your logic in any way.
To use the YUI compressor you will need to have Java installed. Note that if you have the Oracle client installed, you probably have Java already Once you have Java, you can download a copy of the YUI compressor (I’m going to start referring to it as the YC now…). If you don’t feel like downloading Java and the YC – I’ve attached the processed files at the bottom of this post.
Using the YC is simple:
(*Sorry about the overlap. I’m working on a new layout and am addressing that in there)
Running that output all of the compressed of the files down somewhat, to pretty significantly.
A quick comparison of one of the function calls:
As you can see – the savings can be significant.
I’m not using the Fusion viewer yet so I did not process those files, but I did check some of the JS in there and each script file had a huge header comment. It looks like Fusion could also benefit from some compression action. Please note, I’ve been running my web tier using this script for a day or two. I’ve not run any serious testing on this code – so try this at your own risk. You did make that backup I suggested, right? That said, I have not personally experienced any problems yet. Also, should you compress your viewerfiles and have problems be sure to try your backups. Especially before calling your dealer or Autodesk for help. (sorry product support and ADN guys. Please don’t hate me =] ).
if you would rather not run the YC yourself.