Preface
Web application is no longer a simple HTML page, it has become very rich (that is, rich clients), with powerful interactive applications can bring a better user experience. Today's web application brings great opportunities for our developers. However, how can you create javascript code that is faster to download from the server and can be used across browsers and efficiently?
Closure tools helps developers use web development tools to create powerful and efficient rich client web applications. Closure tools include:
Javascript optimizer (a javascript Optimizer)
Javascript enhanced library (a comprehensive JavaScript Library)
Java & JavaScript template system (an easy templating system for both Java & JavaScript)
Javascript style checking tool (a javascript style checker and style fixer)
Enhanced style sheet language (an enhanced Stylesheet Language)
Java & JavaScript template System First, I will focus on the Java & JavaScript template system-closure templates.
Closure templates simplifies the workload of dynamically generating HTML, and its syntax is simple and easy to understand. Compared with the traditional template system, closure templates does not use one (large) Page Template, but uses (small) templates for one small component, which can be reused. You can also use the build-in information to support simple internationalization. Closure templates is implemented by Java and JavaScript, so you can use the same template on the client or server. On the client side, closure templates is pre-compiled into efficient JavaScript code.
The usage of closure templates is as follows:
1. Convenience: Closure templates provides a simple way to Create HTML for your application's user interface (UI), which helps you separate your application logic from display.
2. reusability. Closure templates supports JavaScript and Java, so you can use the same template in the client and service short code.
3. Improve client running speed. Closure templates is compiled into an efficient JavaScript method to maximize client performance.
4. Readability: You can clearly view the output HTML structure based on the template code. The embedded translation information is also quite readable.
5. Tools, rather than frameworks, can work well in any web application environment (libraries, frameworks, or other tools.
6. Security to reduce XSS risks
7 ....
Reference
Https://developers.google.com/closure? Hl = ZH-TW