I have tried to minimize my javascript files using YUI compressor, but to no end, I cannot get the names of functions inside objects to minimize. I have tried to minimize function names in the global scope, but have come to understand this is not possible. Is there any way to minimize javascript code in a way that renames the function names also? Perhaps by encapsulating them in an object somehow? Other than obfuscating, which I have read has quality implications, I cannot think of any other way to protect client side code. Thank You.
Asked
Active
Viewed 188 times
1 Answers
1
Closure-compiler does this when you use ADVANCED_OPTIMIZATIONS. Be warned however, that it does it to everything unless you take specific steps to prevent this. Converting a large code base to be compatible with ADVANCED_OPTIMIZATIONS can be daunting.
See Which Compilation Level is Right for Me?
If you are writing a library that others will consume, there are even more considerations.

Community
- 1
- 1

Chad Killingsworth
- 14,360
- 2
- 34
- 57
-
Yeah I just ran it with advanced optimizations and the whole application failed. Hmmm... – wayofthefuture Sep 05 '13 at 22:28
-
@scuzzlebuzzle That's pretty normal. Usually code takes modification to be compatible. You'll want to use `--warning_level VERBOSE` and take care of all of the errors and warnings first. – Chad Killingsworth Sep 06 '13 at 01:15