开发者

Integrate Google closure compiler with Eclipse IDE?

Does anybody know how to integrate Google closure compiler with Eclipse IDE? The thing I was trying to do is t开发者_运维百科o 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?


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].

After some googling, I also found this, but haven't tested it: 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.

<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>


you could use ant tasks for this http://code.google.com/p/closure-compiler/wiki/BuildingWithAnt


try these eclipse plugins:

Eclipse Plugin for Closure Templates

Eclipse Plugin for JavaScript with Closure Compiler and Closure Library

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

everything works!


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜