Posts In Web Design & Development
How To Fasten Your JavaScript Using Closure Tools?
Hi,
Web applications have come a long way since they were nothing more than simple HTML pages. Now, the world wide web is scattered with rich and highly interactive web applications that serve to enhance user-experience on the website and ensure that users have a pleasant experience.
However, because of their high level features, web applications often tend to be heavy as a result of which the website takes a while to load. And this flaws the first principle of great user experience – Speed. In fact, Google has even gone on to say that the speed of the website might be considered as one of the ranking factors in search results. This has made it even more important for developers to create and maintain JavaScript codes that downloads quickly and works efficiently across different browsers.
Google has introduced a bunch of action-packed Closure Tools that help developers build rich web applications with powerful JavaScript. Here are the popular ones:
Closure Compiler
As per Google, “It is an optimization tool for JavaScript that makes it download and run faster. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls.”
It can remove all the extra portions of comments and code and make the website light-weight and speedier. The Compiler can be used with a sister program called Inspector (a plug-in for Firebug that allows developers to view their optimized code in the browser, with all of their original variable names and other data restored.
Closure Library
Google tells us that “The Closure Library is a broad, well-tested, modular, and cross-browser JavaScript library. It lets you pull out what you need from a large set of reusable UI widgets and controls, and from lower-level utilities for DOM manipulation, server communication, animation, data structures, unit testing, rich-text editing.”
With this, you can abstract browser differences and build clean class and function interfaces for common tasks. The namespacing and import standard of the library helps to limit the size of scripts as a result of which they load fast when used with the Closure Compiler.
Closure Templates
“Closure Templates have a simple syntax that is natural for programmers. In contrast to traditional templating systems, in which you use one big template per page, Closure Templates has comparatively small components that you compose to form your user interface".
Maneet Puri
Managing Director of LeXolution IT Services
Complete Web Solution Company

Posted For: Web Design & Development




