且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Google Closure编译器

更新时间:2021-07-13 01:09:29

Closure Compile现在可以管理Closure依赖项,即使用 goog.provide 和 goog.require 。因此,您不再需要使用 closurebuilder.py 脚本。这就是它被弃用的原因。

Closure Compile can now manage Closure dependencies, that is dependencies defined with goog.provide and goog.require in the JavaScript code. So you do not need to use the closurebuilder.py script anymore. And this is why it's deprecated.

请参阅维基页 https://github.com/google/closure-compiler/wiki/Manage-Closure-Dependencies ,了解Closure Compiler提供的选项/标志。

See the wiki page https://github.com/google/closure-compiler/wiki/Manage-Closure-Dependencies to know about the options/flags Closure Compiler provides for that.

关于生成 deps 文件,这可能是为了调试/开发目的逐个加载js文件所必需的,仍然需要Closure Library的 depswriter.py 脚本。 Closure Compiler没有工具或标志。阅读 https://github.com/google/closure-library/issues/382 depswriter.py 在Google中不再使用,但看起来仍然保留了脚本。

Regarding the generation of deps files, which may be necessary for loading js files one by one for debugging/development purposes, you will still need Closure Library's depswriter.py script. Closure Compiler has no tool or flag for that. Reading https://github.com/google/closure-library/issues/382 depswriter.py is no longer used within Google, but it looks like the script is still maintained.