[英]How to use Google Closure compiler
我正在嘗試從closurebuilder.py腳本遷移到Closure編譯器,因為這條消息:
../../closure-library/closure/bin/build/closurebuilder.py: Closure Compiler now natively understands and orders Closure dependencies and
優先使用此腳本執行JavaScript編譯
由於我使用的是Google Closure Library和OpenLayers 3 ,我如何調用編譯器(compiler.jar)來
讓我們進一步說一切都位於以下結構中。 這幾乎等於我自己的項目,但直接在這里發布是大而復雜的。
project/
src/
js/
<some other js "required" in myapp.js>
myapp.js
myapp-deps.js # This should be the dependency file
lib/
closure/goog/...
third_party/closure/goog/...
myapp.js # This should be the minified version
ol3/
我很感激每一個提示。
Closure Compile現在可以管理Closure依賴項,即在JavaScript代碼中使用goog.provide
和goog.require
定義的依賴項。 所以你不再需要使用closurebuilder.py
腳本了。 這就是它被棄用的原因。
請參閱Wiki頁面https://github.com/google/closure-compiler/wiki/Manage-Closure-Dependencies以了解Closure Compiler為此提供的選項/標志。
關於生成deps
文件,這可能是為了調試/開發目的逐個加載js文件所必需的,你仍然需要Closure Library的depswriter.py
腳本。 Closure Compiler沒有工具或標志。 閱讀https://github.com/google/closure-library/issues/382 depswriter.py
已不再在Google中使用,但看起來仍然保留了該腳本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.