Google Closure Tools

Google Closure Tools[3] is a set of tools to help developers build rich web applications with JavaScript. It was developed by Google for use in their web applications such as Gmail, Google Docs and Google Maps.[4]

Google Closure Tools
Google closure tools logo
Original author(s)Google
Initial releaseNovember 5, 2009[1]
Stable release
v20180716[2] / 16 Jul 2018
Available inJavaScript
TypeAjax framework
LicenseApache License 2.0

Closure Compiler

The Closure Compiler is a tool for making JavaScript download and run faster, at the expense of human readability. It does not compile from JavaScript to machine code, but rather compiles from JavaScript to more efficient JavaScript. It parses JavaScript, analyzes it, removes dead code and rewrites and minifies what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls. It supports transpiling some ECMAScript 6 code to ECMAScript 3, so that programmers can write JavaScript that uses those features, and run it in browsers or other environments that don't yet support them. (The Traceur Compiler is another Google project that supports transpiling ES6 to ES3.) Closure source code can be compiled in three ways:

  • From the command line:
    • Java application that can be passed the list of JavaScript files to be compiled.
    • npm package google-closure-compiler-js (no Java dependencies)
  • Interactively in the browser:
    • The Closure Compiler service website provides a form for a user to input a URL pointing to a JavaScript source or enter JavaScript source code in a textbox. The website will display with the optimized JavaScript on right side for the user to copy. [5]
    • The Closure Compiler server accepts HTTP POST requests. Parameters include the string of JavaScript to be optimized (or a URL pointing to it), the optimization level, whether to include errors and warnings, and the output format (JSON, XML, or text).[6]

The Closure compiler also supports type checking via type annotations that must be written in JSDoc comments.[7]


Programming languages that transpile to JavaScript benefit from Closure Tools. For example, Closure Compiler helps to make ClojureScript practical by making the compiled JavaScript code more efficient.[8]

Closure Library

The Closure Library is a JavaScript library, written specifically to take advantage of the Closure Compiler, based on a modular architecture. It provides cross-browser functions for DOM manipulations and events, Ajax and JSON, as well as more high-level objects such as User Interface widgets and Controls.

Closure Templates

Closure Templates are a templating system for dynamically generating HTML in both Java[9] and JavaScript.[10]

Because the language was apparently referred to as "Soy" internal to Google, and "Soy" remains in some of the documentation and classes,[11] sometimes Closure Templates are referred to as "Soy Templates".

Closure Stylesheets

This is a compiler which provides an extended version of CSS, which is compiled down to ordinary CSS. Internally in Google, this extended version of CSS is referred to as GSS.

See also


  1. ^
  2. ^
  3. ^ Bolin, Michael, "Closure: The Definitive Guide", O'Reilly Media Inc., Sebastopol, CA, 2010
  4. ^
  5. ^ "Online closure compiler".
  6. ^ "Closure compiler API".
  7. ^ "Annotating JavaScript for the Closure Compiler".
  8. ^ "Motivations for using Google's Closure Tools".
  9. ^
  10. ^ JavaScript
  11. ^

External links

Index of JavaScript-related articles

This is a list of articles related to the JavaScript programming language.


JSDoc is a markup language used to annotate JavaScript source code files. Using comments containing JSDoc, programmers can add documentation describing the application programming interface of the code they're creating. This is then processed, by various tools, to produce documentation in accessible formats like HTML and Rich Text Format. JSDoc is free software under the Apache License 2.0.

Tree shaking

In computing, tree shaking is a dead code elimination technique that is applied when optimizing code written in ECMAScript dialects like Dart, JavaScript, or TypeScript into a single bundle that is loaded by a web browser. Rather than eliminating code that can never be executed, tree shaking starts from entry point and includes only the code that is guaranteed to be executed. It is succinctly described as "live code inclusion".

Code analysis
Doc generators
Editors (comparison)
Related technologies
Package managers
Unit testing

This page is based on a Wikipedia article written by authors (here).
Text is available under the CC BY-SA 3.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.