Loading AI tools
JavaScript developer toolkit From Wikipedia, the free encyclopedia
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] As of 2023, the project had over 230K LOCs not counting the embedded Mozilla Rhino compiler.
This article contains content that is written like an advertisement. (October 2019) |
Original author(s) | |
---|---|
Initial release | November 5, 2009[1] |
Stable release | |
Repository | |
Written in | Java |
Available in | JavaScript |
Type | Ajax framework |
License | Apache License 2.0 |
Website | developers |
The Closure Compiler is a tool for making JavaScript downloads 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.
The process executes the following steps:
It also checks syntax, variable references, and types and warns about common JavaScript pitfalls.
It supports transpiling modern ECMAScript code to ECMAScript 5 so that programmers can write JavaScript that uses new ECMAScript features, and run it in browsers or other environments that do not yet support them. This obviated Traceur Compiler, another project that supported transpiling ES6 to ES3.[5]
The Closure compiler also supports type checking via type annotations that must be written in JSDoc comments.[6]
Google provides command line tools used to optimize and compile .js
files:
The Closure Compiler Service application provides a form for a user to input a URL pointing to a JavaScript source or enter JavaScript source code in a text box. The website will display with the optimized JavaScript on the right side for the user to copy.[7]
An API is available, accessible via POST requests, parameters include:
The service is marked as deprecated and will eventually be removed.[8]
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.[9]
Closure Compiler is built upon a modified version of the Rhino JS engine built by Mozilla, Google Guava, a Java standard library, Protocol Buffers, Gson and various other tools for testing. It also ships with built-in JavaScript JSDoc annotations for various popular projects like Node.js' standard API library, JQuery, and Google Map APIs.
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 are a templating system for dynamically generating HTML in both Java[10] and JavaScript.[11]
Since the language apparently referred to as "Soy" internal to Google, and "Soy" remains in some of the documentation and classes,[12] sometimes Closure Templates are referred to as "Soy Templates".
Closure Stylesheets provide extensions to CSS, which are transpired to ordinary CSS. Internally in Google, this extended version of CSS is referred to as GSS.
As of November 2021, Closure Stylesheets have been deprecated in favor of tools such as Sass and PostCSS.[13]
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.