有没有工具删除javascript中未使用的方法? [英] Is there a tool to remove unused methods in javascript?

查看:360
本文介绍了有没有工具删除javascript中未使用的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收集了来自第三方的javascript文件集合,我想删除所有未使用的方法,以便将大小降低到更合理的水平。

I've got a collection of javascript files from a 3rd party, and I'd like to remove all the unused methods to get size down to a more reasonable level.

有没有人知道为Javascript执行此操作的工具?至少给出一个未使用/使用过的方法列表,这样我就可以进行手动修剪?除了运行像YUI Javascript压缩器工具之类的东西之外......

Does anyone know of a tool that does this for Javascript? At the very least give a list of unused/used methods, so I could do the manually trimming? This would be in addition to running something like the YUI Javascript compressor tool...

否则我的想法是编写一个perl脚本来尝试帮助我这样做。

Otherwise my thought is to write a perl script to attempt to help me do this.

推荐答案

不。因为你可以像疯狂动态一样使用这些方法。

No. Because you can "use" methods in insanely dynamic ways like this.

obj[prompt("Gimme a method name.")]();

这篇关于有没有工具删除javascript中未使用的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆