JavaScript Google Closure Compiler Command Line

At the time of writing, anyone that cared to have me on their Twitter timeline would probably have gotten fed up with Tweets about this, so apologies.

Some time ago I gave a talk at a local development group about JavaScript linting, hinting and compiling. One of the features of the talk at the time was on Google’s Closure Compiler service and how it offered a different class of error messages (and minification) from the available linting and hinting tools.

The premise was that, with a simple command line tool, I could hit the compiler service with the contents of a supplied .js file, and output the results in the IDE.

The prototype was kicking around my machine for over a year before I finally decided to make it available to everyone. So with much fanfare, here are the details:

The source code can be found at: JS Google Compile (GitHub). It’s also available as a Visual Studio extension on JS Google Compile (Visual Studio Gallery).

The tool can be plugged into almost all versions of Visual Studio that support “External Tools”. It has also been shown to work in other IDEs that support a similar functionality, including NetBeans and Eclipse. All you need for this to work in your IDE is for it to visualise text written to the standard output stream, and for it to pass the fully qualified file path and name of the currently open file.

For example, in Visual Studio:

1) In your Visual Studio IDE, navigate to Tools->External Tools.

2) Add a menu item with:

  • Title: Whatever you want – I called it &GCC (the ampersand allows you to navigate to it via the keyboard)
  • Command: This is the full path of JsGoogleCompile.exe
  • Arguments: $(ItemPath)
  • Initial directory: $(BinDir)
  • Tick “Use Output Window”


3) Open up your favourite JavaScript file

4) Select the new menu option


5) JsGoogleCompile.exe will emit to the IDE output window.


Any questions, give me a shout.

Leave a Reply