Make Fewer Or Less HTTP Requests With Minify

Add a comment December 23rd, 2009
When we talk about web2.0, fast web, fast page load, web page optimization, website performance, caching etc; the only thing come into our mind is how do we do that? Lets figure it out.

This article is all about using a php library which takes less effort to have fast web pages for your websites. There are lot many points which we should take care of, I am pointing out few important like:

  • Make Less HTTP Requests. (the article is all about this concept)
  • Use Optimized/Compressed CSS and JS library.
  • Optimize Images, (Using PNG 8-bit image format recommended)
  • Use Server Cache (minify have this feature)

The best practice to get a fast web, web page is to make less requests t browser, so that it can serve and render fasts. Multiple objects, library files, includes etc slow down the performance of web.

I found a great library ( based on php ) which combines all JS and CSS files and serve as a single HTTP request to browser, rather than multiple cycle of requests. The new version of this library can make possible combining PHP files as well.

I highly recommend usage of such libraries in our coming applications because as we go forward we need multiple libraries and lot of dependencies and we need to use some cache and fast method of reducing HTTP requests so that we can achieve fast page loading and a better fast web application.

There are lots of others libraries in this area, but I found minify is best of all till now.

Minify Features:

Like Yahoo’s Combo Handler Service, it can combine multiple files, compress their contents without affecting functionality (e.g. removal of unnecessary white space/comments), and serve the results with HTTP encoding (gzip/deflate) and headers that allow optimal client-side caching. Unlike Combo Handler, Minify can combine any JS/CSS files you need for your page. Server-side caching and lazy loading are also used to optimize performance.

  • Combines and minifies multiple CSS or JavaScript files into a single download on the fly
  • Uses a PHP implementation of Douglas Crockford’s excellent JSMin library for JavaScript minification and custom classes to minify CSS and HTML
  • Caches server-side to avoid doing unnecessary work
  • Responds with an HTTP 304 (Not Modified) response when the browser already has the requested content in its cache
  • Most modules are lazy-loaded as needed (304 responses use minimal code)
  • Automatically rewrites relative URLs in combined CSS files to point to valid locations
  • Security is a primary concern; Minify 2 encourages users to explicitly designate which files will be served. V1 limits requests to files within the DOCUMENT_ROOT.
  • With caching enabled, Minify is capable of handling hundreds of requests per second on a moderately powerful server.
  • Content-Encoding: deflate/gzip, based on request headers
  • Test cases for most components
  • Easy integration of 3rd-party minifiers
  • Separate utility classes for HTTP encoding and cache control

Download

  • Download the latest version of Minify.

User Guide

FAQs

  • Please read the FAQ before using it.
Share or Bookmark this Post:
  • StumbleUpon
  • Digg
  • Twitter
  • del.icio.us
  • Facebook
  • Mixx
  • MySpace
  • Reddit
  • Google Bookmarks
  • Yahoo! Buzz
  • Technorati
  • Live
  • DZone
  • Netvibes
  • RSS
  • Print

 

blog comments powered by Disqus
Real Time Web Analytics