PHP: Simple javascript obfuscator (merging files)
posted in /home/PHP on 2010-12-30 |
Currently I'm working on a big JavaScript project. It has a lot of files that have to be compressed. I wrote a simple php class that merges all the files into one. It has also a useful simple obfuscator method.
The php class:
And the usage:
P.S.
the obfuscator method converts short comments (//...) to long comments (/*...*/). If you have a url like "http://site.com" the script will also recognize it as a comment. That's why it's better to write your comment like that:
not:
So just add one more interval after "//".
The php class:
And the usage:
P.S.
the obfuscator method converts short comments (//...) to long comments (/*...*/). If you have a url like "http://site.com" the script will also recognize it as a comment. That's why it's better to write your comment like that:
not:
So just add one more interval after "//".
Delicious