Wednesday, 9 April 2014

Cool tip of the Day Granule

The load time of your web page is often down to the number JS and CSS files that your page includes.
There is a tension between developers and sysadmins, developers want to keep everything simple and in separate editable files while the sysadmins want a nice simple & fast load time.
If you see some of the suggestions on optimising your site (see: http://developer.yahoo.com/performance/rules.html) the suggestion is to keep things together.

80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. Reducing the number of components in turn reduces the number of HTTP requests required to render the page. This is the key to faster pages.
One way to reduce the number of components in the page is to simplify the page's design. But is there a way to build pages with richer content while also achieving fast response times? Here are some techniques for reducing the number of HTTP requests, while still supporting rich page designs.
Combined files are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining all CSS into a single stylesheet. Combining files is more challenging when the scripts and stylesheets vary from page to page, but making this part of your release process improves response times.
SO how to solve this ... for JSP/JAVA devs use Granule (https://code.google.com/p/granule/).
To quote there site...
Granule is an optimization solution for Java-based web applications (JSP, JSF, Grails). It combines and compresses JavaScript and CSS files into less granulated packages, increasing speed and saving bandwidth.
The granule solution includes:
  • JSP Tag library. You just need put the tag around your StyleSheets and JavaScripts to compress and combine them.
  • Ant task, to include pre-compressing in your build scripts.
HAY-PRESTO! Every one is happy.




No comments:

Post a Comment