Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Closure Compiler  



1.1  CLI  





1.2  Closure Compiler Service  





1.3  Ecosystem  





1.4  Internals  







2 Closure Library  





3 Closure Templates  





4 Closure Stylesheets  





5 See also  





6 References  





7 External links  














Google Closure Tools






فارسی

Polski
Српски / srpski
Tiếng Vit
 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


Google Closure Tools
Original author(s)Google
Initial releaseNovember 5, 2009[1]
Stable release

v20230802[2] Edit this on Wikidata / 2 August 2023; 11 months ago (2 August 2023)

Repository
Written inJava
Available inJavaScript
TypeAjax framework
LicenseApache License 2.0
Websitedevelopers.google.com/closure/

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.

Closure Compiler

[edit]

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:

  1. Parses the submitted JavaScript
  2. Analyzes the JavaScript
  3. Removes any dead code
  4. Rewrites and minifies what is left

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]

CLI

[edit]

Google provides command line tools used to optimize and compile .js files:

Closure Compiler Service

[edit]

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

Ecosystem

[edit]

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]

Internals

[edit]

Closure Compiler is build upon modified version of Rhino JS engine build by Mozilla, Google Guava, a Java standard library, Protocol Buffers, Gson and various others tools for testing. It also ships with built-in JavaScript JSDoc annotations for various popular projects like Node.js's standard API library, JQuery, Google Map APIs etc..

Closure Library

[edit]

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

[edit]

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

Since the language was 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

[edit]

Closure Stylesheets provided extensions to CSS, which are transpiled to ordinary CSS. Internally in Google, this extended version of CSS is referred to as GSS.

As of November 2021, Closure Stylesheets has been deprecated in favor of tools such as Sass and PostCSS.[13]

See also

[edit]

References

[edit]
  1. ^ "Introducing Closure Tools - The official Google Code blog". 5 November 2009.
  • ^ "v20230802: RemoveUnusedCode: log reasons for not removing variables". 2 August 2023. Retrieved 4 August 2023.
  • ^ Bolin, Michael, "Closure: The Definitive Guide", O'Reilly Media Inc., Sebastopol, CA, 2010
  • ^ "FAQ - Closure Tools". Google Developers.
  • ^ "Traceur is a JavaScript.next-to-JavaScript-of-today compiler". GitHub.
  • ^ "Annotating JavaScript for the Closure Compiler". GitHub.
  • ^ "Closure Compiler Service".
  • ^ "Closure Compiler Service API Reference". Retrieved 2023-07-18.
  • ^ "Motivations for using Google's Closure Tools". GitHub.
  • ^ "Hello World Using Java". github.com.
  • ^ "Hello World Using JavaScript". github.com.
  • ^ "Google Code Archive - Long-term storage for Google Code Project Hosting". code.google.com.
  • ^ Weizenbaum, Natalie (2021-11-01). "Officially mark this repository as end-of-life". Retrieved 2023-07-18.
  • [edit]
    Retrieved from "https://en.wikipedia.org/w/index.php?title=Google_Closure_Tools&oldid=1224121972"

    Categories: 
    2009 software
    Free software programmed in Java (programming language)
    JavaScript libraries
    Web development software
    Google software
    Hidden categories: 
    Articles with short description
    Short description is different from Wikidata
    Articles with a promotional tone from October 2019
    All articles with a promotional tone
     



    This page was last edited on 16 May 2024, at 11:02 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki