Detect linked & unused files and unused JavaScript

后端 未结 6 683
陌清茗
陌清茗 2020-12-05 07:42

I just finished my website, which I started 2 years ago. I was always trying new things, which sometimes included adding different frameworks or other external JS files.

6条回答
  •  离开以前
    2020-12-05 08:13

    This answer offers Google's Closure Compiler which, in the process of minifying and concatenating your JavaScript code, can remove "dead code".

    Quoting from the documentation for the compilation levels:

    Compilation with ADVANCED_OPTIMIZATIONS removes code that is provably unreachable. This is especially useful in combination with large libraries. If you use only a few functions from a large library file, the compiler can remove everything except those functions from its output.

    Also see this answer which contains more information on Google's Closure Compiler.

提交回复
热议问题