AJAX - The Complete Reference

(avery) #1

266 Part II: Developing an Ajax Library^


CSS Optimizations
CSS is also ripe for simple optimizations. In fact, most CSS created today tends to compress
much harder than (X)HTML. The following techniques are all safe, except for the final one
where the complexities of which demonstrate the extent to which client-side Web technologies
can be intertwined.


  1. Remove CSS whitespace.


As is the case with (X)HTML, CSS is not terribly sensitive to whitespace, and thus
its removal is a good way to significantly reduce the size of both linked CSS files
and <style> blocks.


  1. Remove CSS comments.
    Just as with markup comments, CSS comments should be removed, as they provide
    no value to the typical end user. However, a CSS masking comment in a