Does anyone know of a JavaScript minifer that can detect unused code and strip it out.
Google Closure seems alright but it appears to only compact.
I'm looking for something much more advanced, where it can look through my JavaScript and not only compact but also remove unused code.
Anyone know of such a tool?
The use base being, I use very little functionality of JQuery - what I would like to do is remove from the base/core all the bloat that is unneeded from my use.
Closure Compiler should do the job, from the Closure FAQ
Closure Compiler helps reduce the size of your JavaScript by removing comments and unused code and shrinking the remaining code.
Probably not.
The problem is that there's no guaranteed way to figure out what's used and what isn't. Javascript can be used/referenced from HTML, the script(s) could be used with other unknown scripts that use otherwise unused code and eval() blocks may use things you don't realize.
Minify and gzip it and that's enough. If not, cull it by hand (although getting rid of code is a lot harder than adding it in the first place).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With