These projects are retired. The development has stopped and we don't provide support for them anymore.

Name -- reduces the code size of javascript files.


This perl script has been written since the size of the javascript code for RelativeLayers started to become much too big to justify its download for regular websites. It goes much further than the standard removal of white-space and comments. It also renames all private variables, functions, members an methods to shorter alternatives.

Instead of creating a complete javascript language parser that understands all the logic structures and rebuilds the code in a denser format, another approach has been chosen. Strict coding guidelines have been enforced during the development. This allows simple regular expressions to identify the names that need to be replaced by shorter strings. Overall this wasn't such a bad thing since it made the code very comprehensible and easy to maintain.

The results are very effective and currently reduce the size of the files by about 65%. Thanks to this algorithm it was possible to add a lot of functionality to RelativeLayers without having to worry too much about the size of the code.


Just execute the script in the RelativeLayers directory : './'.

If you add code to RelativeLayers in new files or have new functions or methods that may not be replaced by shorter names, then you will need to add those to the beginning of the script in the @filesToProcess, %functionsToSkip and %methodsToSkip collections.

Coding guidelines

Following are the guidelines that need to be applied to make it possible for the perl script to do its job and to stick to what has been and will be used during the development.