Javascript 谷歌关闭缩小器在线?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2030671/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-22 22:28:48  来源:igfitidea点击:

Google Closure minifier online?

javascriptminifygoogle-closure

提问by Geuis

Has anyone setup an online copy/paste utility for Google's Closureminifier?

有没有人为Google 的 Closureminifier设置在线复制/粘贴实用程序?

I'm working on a project and I want to minify part of the code manually without having to setup the entire project on my own.

我正在处理一个项目,我想手动缩小部分代码,而不必自己设置整个项目。

回答by Roland Bouman

How about google's own service: http://closure-compiler.appspot.com/home

google自己的服务怎么样:http: //closure-compiler.appspot.com/home

I should point out that "setting up the entire project on my own" really is not half as scary as you make it out to be :p.

我应该指出,“我自己设置整个项目”真的没有你想象的那么可怕:p。

I mean, it's a matter of downloading a java.jar and running it. Instructions:

我的意思是,这是下载 java.jar 并运行它的问题。指示:

  1. Download at http://closure-compiler.googlecode.com/files/compiler-latest.zip
  2. Unzip
  3. run java command line:

    java -jar compiler.jar --js script-src.js --js_output_file script-compiled.js

  1. http://closure-compiler.googlecode.com/files/compiler-latest.zip下载
  2. 解压
  3. 运行java命令行:

    java -jar compiler.jar --js script-src.js --js_output_file script-compiled.js

where <compiler.jar>is the full location to the compiler.jarfile in the downloaded archive, script-src.jsis the full filename of the source file, and script-compiled.jsis the full filename of the result.

其中<compiler.jar>compiler.jar下载档案中文件的完整位置,script-src.js是源文件script-compiled.js的完整文件名, 是结果的完整文件名。

回答by edoceo

Google offers the Closure Compiler via REST API, which you can invoke from a shell

Google 通过 REST API 提供 Closure Compiler,您可以从 shell 调用它

https://developers.google.com/closure/compiler/docs/gettingstarted_api

https://developers.google.com/closure/compiler/docs/gettingstarted_api

curl -v \
    -d code_url=http://server/js/file-big.js \
    -d compilation_level=ADVANCED_OPTIMIZATIONS \
    -d output_info=compiled_code \
    -d output_format=text \
    http://closure-compiler.appspot.com/compile \
    > radix.min.js