Compress Javascript/CSS to keep web pages lightweight, and improve its performance


Improving the design of a page or a web application usually yields the biggest savings and that should always be a primary strategy. There are many secondary strategies for improving performance such as minification of the code, HTTP compression, using CSS sprites, etc.

The importance of keeping web pages as lightweight as possible can be understood by the fact that about 20% of all page views can be done with an empty cache using these techniques! 40% to 60% of web users could have an empty cache experience.

In terms of code minification, one of the the most widely used tools is to minify JavaScript code. Most of the file size reduction is achieved by removing comments and extra whitespace characters that are not needed by web browsers or visitors. It can also be useful measure in order to make it obfuscate(unclear) javascript code from external users.

The goal of JavaScript and CSS minification is always to preserve the operational qualities of the code while reducing its overall byte footprint (both in raw terms and after gzipping, as most JavaScript and CSS served from production web servers is gzipped as part of the HTTP protocol).

There are many sites available for compressing Javascript or JS Code online like refresh-sf.com/yui/jscompress.com. You can either upload your js file or simply copy code.

There are many other sites, just google ‘compress javascript code’. Likewise, you can compress your CSS files too; google ‘compress css’.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s