back to krasimirtsonev.com
to blog's home page

PHP: Simple javascript obfuscator (merging files)

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 "//".
Sharing ...
Commenting ...
blog comments powered by Disqus