将 Google 闭包编译器与 Eclipse IDE 集成?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3287771/
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-09-19 14:54:39  来源:igfitidea点击:

Integrate Google closure compiler with Eclipse IDE?

eclipseminifygoogle-closure-compiler

提问by Borivojevi?

Does anybody know how to integrate Google closure compilerwith Eclipse IDE? The thing I was trying to do is to configure Google closure compiler as a external tool for Eclipse IDE. Then I would be able to run closure compiler within IDE and minify my Javascript files with single click. Have anybody solved this problem yet?

有人知道如何将Google 闭包编译器与 Eclipse IDE 集成吗?我试图做的事情是将 Google 闭包编译器配置为 Eclipse IDE 的外部工具。然后我就可以在 IDE 中运行闭包编译器并通过单击缩小我的 Javascript 文件。有没有人解决过这个问题?

采纳答案by Hymanocnr

Rock Star Apps provide a little-known plugin which does this. I just wrote a blog article on it: [removed as doesn't exist anymore].

Rock Star Apps 提供了一个鲜为人知的插件来执行此操作。我刚刚写了一篇关于它的博客文章:[删除,因为不再存在]。

After some googling, I also found this, but haven't tested it: https://github.com/greggian/Eclipse-Closure-Compiler.

经过一番谷歌搜索,我也发现了这一点,但尚未对其进行测试:https: //github.com/greggian/Eclipse-Closure-Compiler

Update: the Rock Star Apps site no longer works. Were I to try to do this today, I would definitely just download the closure compiler jar, write an ant script to run it (something like the code below), and then create a project builder for it.

更新:Rock Star Apps 网站不再有效。如果我今天尝试这样做,我肯定会下载闭包编译器 jar,编写一个 ant 脚本来运行它(类似于下面的代码),然后为它创建一个项目构建器。

<target name="rebuild">

    <taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask"
            classpath="/opt/closure-compiler/compiler.jar"/>

    <jscomp compilationLevel="simple" warning="quiet" 
        debug="false" output="js/all.closure.js">
        <sources dir="js">
            <file name="script1.js"/>
            <file name="script2.js"/>
            <file name="script3.js"/>
            <file name="script4.js"/>
            <file name="script5.js"/>
            <file name="script6.js"/>
        </sources>
    </jscomp>

</target>

回答by user783225

try these eclipse plugins:

试试这些 Eclipse 插件:

Eclipse Plugin for Closure Templates

用于闭包模板的 Eclipse 插件

Eclipse Plugin for JavaScript with Closure Compiler and Closure Library

带有闭包编译器和闭包库的 JavaScript Eclipse 插件

http://www.normalesup.org/~simonet/soft/index.en.html

http://www.normalesup.org/~simonet/soft/index.en.html

everything works!

一切正常!

回答by Shiraz Bhaiji

This podcasthas some info on how the closure compiler might fit into the IDE. But it was published before closure was released.

这个播客有一些关于闭包编译器如何适合 IDE 的信息。但它是在关闭发布之前发布的。

回答by Anno

You might be interested in http://plovr.com/, a Closure build tool. It dynamically recompiles JavaScript and Closure Template code.

您可能对http://plovr.com/感兴趣,这是一个闭包构建工具。它动态地重新编译 JavaScript 和闭包模板代码。