开发者

What is the best JavaScript compression/obfuscation tool? [closed]

As it currently stands, this question is not a good fit for our Q&A 开发者_运维问答format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

What kind of a tool would you recommend for JavaScript compression and/or obfuscation? A google search comes back with a lot of online tools, but I am not sure how to gauge their effectiveness/usefulness.

Is there a tool that you would recommend for this?

Thanks,


There are many tools that transform Javascript in something different. I currently classify these tools in the following objectives:

  1. Minify: make the code smaller by removing comments, renaming variables...
  2. Compress: Compress using non destructive compression of javascript
  3. Optimize: Make the code run faster (ex: Closure)
  4. Obfuscate: Protect the code

My order has some meaning behind it. Because generally the higher level includes all be features below.

So a good Javascript Obfuscator is able to minify, compress, optimize...

Many tools do some of these levels well individually. They can be combined making them more effective but my experience has shown that combining several such tools make it a nightmare to try and pin point a problem.

My suggestion for a good overall Javascript obfuscator would be to use jscrambler.com

For optimization and minification google closure (has sugested by aepheus) is a excellent solution.


Closure Complier: http://code.google.com/closure/compiler/

YUI Compressor: http://developer.yahoo.com/yui/compressor/

Come to mind. You'll want to take them for a spin with your own code, as a lot of factors come into play with minifying. Basically, see which one makes the smallest file (and verify that your code works as it should).


UglifyJS: https://github.com/mishoo/UglifyJS

The page contains a comparison with other minifiers if you scroll down a bit. One of the most notable parts is this:

UglifyJS is the fastest to run. On my laptop UglifyJS takes 1.35s for DynarchLIB, while YUI takes 2.7s and GCL takes 6.5s.

It written in JavaScript, so no need for separate runtimes etc. It plays nicely with both node.js and npm.


you can also try http://openwaf-js-mini.appspot.com ,slightly better than YUI Compressor

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜