Closure Tools are a set of utilities used for web development. It is mainly supported by Google, but is open source under the Apache License Version 2.0, a well-established permissive license. The name Closure Tools hides under it a lot of subtools, which will make your life as an apprentice developer easier. It includes a JavaScript optimizer, a JavaScript library, a templating library, a style checker and style fixer, and at last, a stylesheet language. Just to illustrate how powerful this set can be, think that most Google JavaScript applications, such as Gmail or Google Maps, use these components.
Why are we introducing you to these tools?
The OpenLayers 3 library itself depends on the Closure Library, the JavaScript library attached to Closure Tools. Its main goal is to leverage cross-browser support. You also know you can write your application in pure JavaScript.
However, you can also consider Closure for advanced uses like creating your own component such as controls and buttons with special behavior inherited from an existing OpenLayers component. You will also get some useful UI components. It is also a good toolset to achieve better file compression when you want an efficient web mapping application, using the Closure Compiler, another utility from the Closure Tools bundle.
We will not review all Closure Tools but only the most useful. Specifically, we will cover the following topics:
Understanding the Closure Tools concepts
How to use the Closure Library and a small review of the main components' families
Why Closure Compiler is different from others compiler tools
How to use it with Closure Library and with other JavaScript libraries. Application of Closure Tools in OpenLayers for improving our way of developing web-mapping applications
The use of the already hidden workflow in OpenLayers code that relies on Closure Tools
Best practices for creating readable code and how to detect and fix errors using both Closure style checker and style fixer