Skip to Main Content

Let's Look at Minify

Posted on 9.09.2007

View the source code on your webpage and you may find that there are multiple CSS or JavaScript files. While CSS simplifies design and JavaScript adds essential functionality, the browser must request each referenced file individually (and wait for them to finish), which often causes pages to load slower than your users are willing to wait. The issue of latency is an important one for designers and developers and should be addressed if you find that users are not getting the whole "experience" from your site.

Found within Google Code: "Minify attempts to fix this problem by combining multiple CSS or JavaScript files into one download. By default, it also removes comments and unnecessary whitespace to decrease the amount of data that must be sent to the browser. Most importantly, it does all of this on the fly and requires only a few simple changes to your existing web pages."

Sounds pretty interesting. Let's take a closer look. Say for example that you have two CSS files and two JavaScript files. Your HTML would look something like this:


When you implement Minify on your server (through mod_rewrite on an Apache server, or through a PHP script), it would look something like this:


As you can see, just one request is necessary to pull up multiple external CSS and JavaScript files.

Today's Top Picks for Our Readers:
Recommended by Recommended by NetLine

Leave Your Comment

Login to Comment

Become a Member

Not already a part of our community?
Sign up to participate in the discussion. It's free and quick.

Sign Up


Leave a comment
    Load more comments
    New code