使用google闭包编译器编译javascript的构建方法

c2c.recipe.closurecompile的Python项目详细描述


使用Google Closure Compiler压缩javascript文件

用法

最小构建配置示例:

[buildout]
parts = closure-compile

[closure-compile]
recipe = c2c.recipe.closurecompile
compiler = path/to/closure-compiler.jar
level = SIMPLE_OPTIMIZATIONS
source_map = foo/bar.map
externs = externs/a.js externs/b.js
input = foo/bar.js
output = foo/bar.min.js
output_mode = compiled
compiler_flags = --generate_exports

其中:

  • ^{tt1}$: The location of the compiler jar file.
  • ^{tt2}$: The compilation level: ^{tt3}$, ^{tt4}$ or ^{tt5}$. Default is ^{tt3}$.
  • ^{tt7}$: Path to the source map file. Optional.
  • ^{tt8}$: A list of optional externs files.
  • ^{tt9}$: The files to compress separated with spaces. The path can be absolute or relative to the buildout directory. These files are also used to calculate the dependencies in addition to the ^{tt10}$ option.
  • ^{tt11}$: The list of paths that should be traversed to build the dependencies.
  • ^{tt10}$: One or more namespaces to calculate dependencies for.
  • ^{tt13}$: The path to the minified file.
  • ^{tt14}$: The type of output to generate from this script. Options are “list” for a list of filenames, “script” for a single script containing the contents of all the files, or “compiled” to produce compiled output with the Closure Compiler. Default is “compiled”.
  • ^{tt15}$: A space seperated list of additional compiler flags for the Closure Compiler. They are passed to the compiler as specified. Optional.

深度写入程序

使用DepsWriter写入依赖项文件。

最小构建配置示例:

[buildout]
parts = depswriter

[closure-compile]
recipe = c2c.recipe.closurecompile:depswriter
root_with_prefix = myproject ../../myproject
                   ../source/ ../../../../source/
output = path/to/deps.js

其中:

  • ^{tt16}$: A list of paths and prefixes.
  • ^{tt13}$: The path to the dependency file, can be absolute or relative to the buildout directory.

注意,rootpath_with_depspath选项来自 尚不支持原始depswriter.py脚本。

得到罐子

要从google自动下载并解压缩编译器,您可以 使用hexagonit.recipe.download收据:

[buildout]
parts = closure-compile

[closure-compile]
recipe = c2c.recipe.closurecompile
compiler = ${download-closure-compile:destination}/compiler.jar
...

[download-closure-compile]
recipe = hexagonit.recipe.download
url = http://closure-compiler.googlecode.com/files/compiler-latest.zip

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java无法调用扩展超级非抽象类的抽象类方法   java Hibernate 5关联[]引用了一个未映射的实体[]:origin(User.hbm.xml)   java禁用JSpinner中的数字分组   java Spring的环境抽象是否使用PropertyEditor?   java是否创建自定义注释作为FrameworkAnnotation的别名?   java如何将Selenium安装为Unix守护程序?   java三值if运算符在正则if-one中   有人能帮我在一个程序上分析java代码吗?   java Spring集成5.0反应堆类型支持   java Websphere 7线程转储分析   java Akka期货和监管策略如何应对失败   使用Clojure中的可选参数调用java函数的构造函数   java如何消除安卓按钮的延迟?   Android上使用X.509证书的java认证应用程序   java如何获取列表中特定类型的所有对象?   java如何将json数组字符串转换为json对象   安卓 Java从长时间返回的日期不正确   java Android Studio在尝试从TextEdit搜索单词时崩溃   ViewPager的java子项