Google Closure Tools is a set of tools to help
developers build rich
web application
A web application (or web app) is application software that is accessed using a web browser. Web applications are delivered on the World Wide Web to users with an active network connection.
History
In earlier computing models like client-serv ...
s with
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
. It was developed by
Google
Google LLC () is an American Multinational corporation, multinational technology company focusing on Search Engine, search engine technology, online advertising, cloud computing, software, computer software, quantum computing, e-commerce, ar ...
for use in their
web application
A web application (or web app) is application software that is accessed using a web browser. Web applications are delivered on the World Wide Web to users with an active network connection.
History
In earlier computing models like client-serv ...
s such as
Gmail
Gmail is a free email service provided by Google. As of 2019, it had 1.5 billion active users worldwide. A user typically accesses Gmail in a web browser or the official mobile app. Google also supports the use of email clients via the POP and ...
,
Google Docs and
Google Maps
Google Maps is a web mapping platform and consumer application offered by Google. It offers satellite imagery, aerial photography, street maps, 360° interactive panoramic views of streets ( Street View), real-time traffic conditions, and rou ...
.
Closure Compiler
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
In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ve ...
, but rather compiles from JavaScript to more efficient JavaScript.
It
parses JavaScript, analyzes it,
removes dead code and rewrites and
minifies what is left. It also checks
syntax,
variable
Variable may refer to:
* Variable (computer science), a symbolic name associated with a value and whose associated value may be changed
* Variable (mathematics), a symbol that represents a quantity in a mathematical expression, as used in many ...
references, and
types
Type may refer to:
Science and technology Computing
* Typing, producing text via a keyboard, typewriter, etc.
* Data type
In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allo ...
and warns about
common JavaScript pitfalls. It supports
transpiling modern
ECMAScript
ECMAScript (; ES) is a JavaScript standard intended to ensure the interoperability of web pages across different browsers. It is standardized by Ecma International in the documenECMA-262
ECMAScript is commonly used for client-side scripting o ...
code to ECMAScript 5, so that programmers can write JavaScript that uses those features, and run it in
browsers
Browse, browser or browsing may refer to:
Programs
* Web browser, a program used to access the World Wide Web
*Code browser, a program for navigating source code
* File browser or file manager, a program used to manage files and related objects
* ...
or other environments that do not yet support them. (the Traceur Compiler is another Google project that supports transpiling ES6 to ES3.)
CLI based tools
Tool set provide a
command line
A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
tools used to optimize and compile
.js
files:
*
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mos ...
-based application run from shell which compiles a list of specified JavaScript files
*
npm package
google-closure-compiler
which provides as optional dependencies three compilers: native (binary executable), JAVA and JavaScript-based one; which are installed at once.
Others
*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 text box. The website will display with the ''optimized JavaScript'' on right side for the user to copy.
*HTTP POST API:
**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).
The Closure compiler also supports
type checking
In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
via type annotations that must be written in
JSDoc
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 ...
comments.
Ecosystem
Programming languages that transpile to JavaScript benefit from Closure Tools. For example, Closure Compiler helps to make
ClojureScript
Clojure (, like ''closure'') is a dynamic and functional dialect of the Lisp programming language on the Java platform. Like other Lisp dialects, Clojure treats code as data and has a Lisp macro system. The current development process is com ...
practical by making the compiled JavaScript code more efficient.
Closure Library
The Closure Library is a
JavaScript library A JavaScript library is a library of pre-written JavaScript code that allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies.
Libraries
With the expanded demands for JavaScript, an ea ...
, written specifically to take advantage of the Closure Compiler, based on a
modular architecture. It provides
cross-browser
Cross-browser compatibility is the ability of a website or web application to function across different Web browser, browsers and Fault tolerance, degrade gracefully when browser features are absent or lacking.
History
Background
The history ...
functions for
DOM Dom or DOM may refer to:
People and fictional characters
* Dom (given name), including fictional characters
* Dom (surname)
* Dom La Nena (born 1989), stage name of Brazilian-born cellist, singer and songwriter Dominique Pinto
* Dom people, an et ...
manipulations and
events
Event may refer to:
Gatherings of people
* Ceremony, an event of ritual significance, performed on a special occasion
* Convention (meeting), a gathering of individuals engaged in some common interest
* Event management, the organization of ev ...
,
Ajax
Ajax may refer to:
Greek mythology and tragedy
* Ajax the Great, a Greek mythological hero, son of King Telamon and Periboea
* Ajax the Lesser, a Greek mythological hero, son of Oileus, the king of Locris
* ''Ajax'' (play), by the ancient Gree ...
and
JSON, as well as more high-level objects such as
User Interface
In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
widgets and Controls.
Closure Templates
Closure Templates are a
templating system for dynamically generating
HTML
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaSc ...
in both
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mos ...
and
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
.
Because the language was apparently referred to as "Soy" internal to Google, and "Soy" remains in some of the documentation and classes,
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
*
Google Web Toolkit
Google Web Toolkit (GWT ), or GWT Web Toolkit, is an open-source set of tools that allows web developers to create and maintain JavaScript front-end applications in Java. It is licensed under the Apache License 2.0.
GWT emphasizes reusab ...
*
JSDoc
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 ...
*
TypeScript
TypeScript is a free and open source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language. It is designed for the development of large app ...
*
Minification (programming)
Minification (also minimisation or minimization) is the process of removing all unnecessary characters from the source code of interpreted programming languages or markup languages without changing its functionality. These unnecessary characters ...
*
Source-to-source compiler
A source-to-source translator, source-to-source compiler (S2S compiler), transcompiler, or transpiler is a type of translator that takes the source code of a program written in a programming language as its input and produces an equivalent sou ...
References
External links
*
Package for TYPO3 Flow
{{JavaScript
2009 software
Free software programmed in Java (programming language)
JavaScript libraries
Web development software
Closure Tools