Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/425.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用Google闭包编译器_Javascript_Google Closure Compiler_Google Closure_Google Closure Library - Fatal编程技术网

Javascript 如何使用Google闭包编译器

Javascript 如何使用Google闭包编译器,javascript,google-closure-compiler,google-closure,google-closure-library,Javascript,Google Closure Compiler,Google Closure,Google Closure Library,由于以下消息,我正在尝试从closurebuilder.py脚本迁移到: ../../closure-library/closure/bin/build/closurebuilder.py: Closure Compiler now natively understands and orders Closure dependencies and 优先于使用此脚本执行JavaScript编译 既然我正在使用和,那么如何调用编译器(compiler.jar)来 构建myapp-deps.js依赖

由于以下消息,我正在尝试从closurebuilder.py脚本迁移到:

../../closure-library/closure/bin/build/closurebuilder.py: Closure Compiler now natively understands and orders Closure dependencies and
优先于使用此脚本执行JavaScript编译

既然我正在使用和,那么如何调用编译器(compiler.jar)来

  • 构建myapp-deps.js依赖项文件
  • 构建一个只包含使用过的OL3和CL类的缩小版myapp.js
  • 使用预先计算的OL3和CL依赖文件(例如OL3 deps.js)构建这两个文件
让我们进一步假设所有内容都位于以下结构中。这几乎等同于我自己的项目,但直接发布在这里又大又复杂

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/
项目/
src/
js/
myapp.js
myapp-deps.js#这应该是依赖项文件
解放党/
闭包/goog/。。。
第三方/关闭/goog/。。。
myapp.js#这应该是缩小版
ol3/

我非常感谢每一个提示。

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

请参阅wiki页面,了解闭包编译器为此提供的选项/标志

关于生成
deps
文件,为了调试/开发目的逐个加载js文件可能需要这些文件,您仍然需要Closure库的
depswriter.py
脚本。闭包编译器对此没有工具或标志。Google不再使用Reading
depswriter.py
,但该脚本似乎仍在维护中