Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 460
Borivojević Avatar asked Jul 20 '10 07:07

Borivojević


People also ask

Does Google have a compiler?

Previously built using the Microsoft C++ compiler, Google is now using the same compiler for Windows, macOS, Linux, and Android, and the switch makes Chrome arguably the first major software project to use Clang on Windows.

How does Closure compiler work?

The Closure Compiler is a tool for making JavaScript download and run faster. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left.


2 Answers

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>
like image 174
jackocnr Avatar answered Sep 24 '22 11:09

jackocnr


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

like image 4
tarmo Avatar answered Sep 21 '22 11:09

tarmo