This directory contains the sources of a Javascript shrinker and name obfuscator made especially for the yFiles for HTML library
While (at the time of writing) you are not required to obfuscate the yFiles library prior to deploying your application on a public web server, we highly recommend applying a shrinker and obfuscator in order to dramatically reduce the download size of the library files for the end-user.
The clear names of the members of the yFiles API alone make up several hundred kilobytes of javascript code. The yFiles library has been written in such a way that it is possible to shrink these names to a minimum, often resulting in several hundreds of kilobytes reduction.
This directory contains an Ant build file that can be used to compile the shrinker code from the supplied sources. The shrinking tool depends on sources from the Apache Rhino Javascript engine project, that is also part of modern JDK implementations. During the ANT-build, the sources of the Rhino distribution are downloaded from the public source code repository and the obfuscator is compiled against these sources.
The build file contains an example configuration that will obfuscate one of the demo applications in the yFiles for HTML package. Obfuscating a different application is as easy as replacing the name of the demo application.
The build file also demonstrates how to use another tool like in this case the YUI Compressor, to shrink your own javascript files even more than this tool will do. 3rd Party shrinking tools should not be used on the library, however, but just on your custom code. We recommend as shown in the build file to apply a two-step shrinking process, where first the library shrinker in this directory is used to minify the library names (the library itself is already minified) and adjust the references in your javascript files, and in a second step a multi-purpose shrinker/minifier is applied to your application files.
For more details about the process, please read the comments in the build.xml
file and refer to the sources of the obfuscator or contact our support team that will
gladly help you get the best size reduction for your usecase.