jsfmt and jsobf available for download
By popular request I have made my JavaScript minimizer and obfuscator available for download. The jsobf program strips JavaScript source code down to the minimum whitespace required to separate the tokens, and performs automatic semicolon insertion to completely irradiate the need for line breaks. It also offers some obfuscation by renaming identifiers.
Also available here is a JavaScript formatter, jsfmt, which reverses the minimizing process. This is useful for inspecting untidy source code, or code that has been minimized for obfuscation purposes.
» Download jsobf-1-2-0
» Download jsfmt-1-0
Both these programs are PHP command line scripts and require at least version 5.2 of the PHP CLI binary. Windows is not supported, and probably never will be.
I hope you find them useful.
Tags: JavaScript
September 8th, 2008 at 10:08 pm
If you are obfuscating source code to use with the Prototype library, be careful. Prototype actually interrogates parts of your source code literally!!! The only example I am aware of so far is the use of $super as a function argument. This cannot be renamed because Prototype searches for it as a string literal.
To solve this problem, use the –protect option of jsobf, and don’t forget to escape your “$” symbols ;)
jsobf –protect=\$super