JavaScript 剥离器:删除网页中未使用的函数/对象 [英] JavaScript stripper: remove functions/objects that are not used in a web page
问题描述
我所有的网页都使用 JavaScript 库,为了提高我的网页的性能,我会根据每个页面的需要从库中删除所有不必要的函数/对象.我正在寻找一种可以自动进行智能剥离的工具.
All of my web pages use a JavaScript library, to improve the performance of my web page, I'd remove all the unnecessary functions/objects from the library for each page according to what's needed for those individual pages. I'm looking for a tool that can do the intelligent stripping automatically.
或者相反的方向.它还需要一个工具来为特定页面从 JavaScript 库中仅提取真正需要的函数和对象.
Or in the opposite direction. it will do also to have a tool to extract only the really needed functions and objects from a JavaScript library for a particular page.
感谢您的帮助,
于
推荐答案
对我来说,这听起来像是非常不成熟的优化.您是否验证过您不使用的库函数的存在会导致性能问题?如果真是这样,我会感到非常惊讶.
This sounds like very premature optimization to me. Have you verified the mere presence of the library functions you aren't using are causing performance problems? I would be very surprised if that is truly the case.
一如既往,代码优先,只有在您发现性能问题、分析和隔离原因后才进行优化.
As always, code first, only optimize after you've recognized a performance problem, profiled and isolated the cause.
这篇关于JavaScript 剥离器:删除网页中未使用的函数/对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!