Google Closure Compiler to Minimize and Optimize JavaScript Online
Optimizing JavaScript code to make it faster and more compact is an important step in website optimization. Minimizing JavaScript code to make it smaller in size improves website speed and reduces the bandwidth needs. Since JavaScript is an integral part of almost all the websites in internet, any steps to improve it and optimize it will yield positive results.
Optimizing JavaScript means more than just minimizing it. It also includes the removal of dead code, optimize existing code and find pitfalls in the code. We have discussed about various methods to minify JavaScript and CSS in earlier posts. GZip compression along with minification is a good practice to improve the website performance in terms of speed and performance.
You may also like to Read:
- Minify JS (JavaScript) and CSS files to speed up your website
- 7 steps to Speed up website loading – Website Optimization Tips
- Speed up website -Compress CSS/JavaScript using GZIP/DEFLATE compression
Closure Compiler to Make JavaScript Compact and Compile Into high-performance Code
Closure Compiler is part of Google Closure Tools. Closure tools help developers to build rich web applications with JavaScript. The Closure Compiler compiles JavaScript into compact, high-performance code. It minimizes the code not just by removing white spaces or new lines, but removes dead code and rewrites and minimizes it make it more efficient and compact.
Closure Compiler checks syntax, variable references, and types and removes any unused variables and other invalid references. The tool also warns about common JavaScript pitfalls in the existing code. Since the Closure Compiler reduces the size of your JavaScript files through minification process, this will help the website to load faster and reduces the bandwidth needs.
The tool also identifies illegal JavaScript which performs potentially dangerous operations and will issue warnings.
Closure Compiler offers three levels of compilations like white space only (WHITESPACE_ONLY), simple optimizations (SIMPLE_OPTIMIZATIONS) and advanced optimization (ADVANCED_OPTIMIZATIONS) compilation. SIMPLE_OPTIMIZATIONS is the default level of compilation.
The WHITESPACE_ONLY compilation level removes comments from your code and also removes line breaks, unnecessary spaces, and other white space but the SIMPLE_OPTIMIZATIONS level does the following extra steps,
- Optimizations within expressions and functions
- Renaming local variables and function parameters to shorter names
The ADVANCED_OPTIMIZATIONS compilation level performs all the operations as SIMPLE_OPTIMIZATIONS level but also performs the below mentioned additional steps,
- More aggressive renaming
- Dead code removal
- Global inlining
- Enable extreme compression by making “strong assumptions” and may result in code that does not run, if your code does not conform to those assumptions.
Access Google Closure Compiler
You can read more about Closure Compiler Compilation Levels and advanced Compilation and Externs
Join Globinch on Social Media
Follow Globinch
Popular Posts
- Turn your Windows 7 Computer Into a Personal Wi-Fi Hotspot 20 comment(s) | 26,498 view(s)
- Search Engines for File Sharing Sites : Rapidshare Search, Megaupload and More 2 comment(s) | 18,457 view(s)
- Google Translate Now supports Bengali, Gujarati, Kannada, Tamil and Telugu 2 comment(s) | 17,346 view(s)
- Best PDF OCR Tools to Convert Scanned images to Text / Word Documents 4 comment(s) | 13,642 view(s)
- Google Top Searches Today – Hot Google Search Words today 8 comment(s) | 13,504 view(s)
- Globinch Search 0 comment(s) | 10,389 view(s)
- Access Blocked sites, Unblock Restricted Websites 16 comment(s) | 9,453 view(s)
- Password Revealer – How To Reveal- Show Password Behind Asterisks? 1 comment(s) | 8,517 view(s)
- Play Angry Birds Game Free and Offline in Chrome Browser 1 comment(s) | 8,244 view(s)
- Free Online OCR Software to Convert Images Into Searchable PDF, Doc, HTML or Text 2 comment(s) | 8,083 view(s)
Recent Articles
- How to Use Wi-Fi the Secure Way
- 5 Apps to Boost Android Performance
- Building a Smarter Site Using a WordPress Platform
- Samsung Galaxy S IV Smartphone :Summary of All the Radical Innovations
- 5 Killer Tips to Increase Traffic to Your Blog
- Domain Parking to Make Genuine Money Online
- SEO Is Not Dead, But You Need to Upgrade The Process
- A Complete SEO Guide on Using Social Media for Better SERPs
- When Should You Use Geotargeting or Setting Geographic Target in Google Webmaster Tools?
- How To Optimize Your Google+ Page And Profile For Search Engines








