JavaScript minifier that removes unused code

Does anyone know of a JavaScript mini-hitter that can detect unused code and disable it.

Google Closure looks good, but it seems compact.

I am looking for something much more advanced, where it can view my JavaScript and not only compactly, but also delete unused code.

Does anyone know about such a tool?

The base used, I use very little JQuery functionality - what I would like to do is remove from the base / kernel all the bells and whistles that are not needed from my use.

+4
source share
2 answers

The Closure compiler should do the job, of Closing Frequently Asked Questions

The Closure Compiler helps reduce the size of your JavaScript by removing comments and unused code and reducing the remaining code.

+2
source

Probably no.

The problem is that there is no guaranteed way to find out what is used and what is not. Javascript can be used / referenced in HTML, the script can be used with other unknown scripts that use otherwise unused code, and eval () blocks can use things you don't understand.

Minimize and gzip and that's enough. If not, drop it manually (although getting rid of the code is a lot more complicated than adding it first).

+1
source

All Articles