|
Posted by Joost Diepenmaat on July 3, 2008, 10:34 am
Please log in for more thread options
>> I have a large CSS file which has classes defined such as:
>> myclass {
>> margin-right:7px;
>> margin-top:5px;
>> padding-bottom:5px;
>> padding-top:5px;
>>
>> }
>>
>> I would like to reduce the CSS file to its minimum with
>> - redundant lines removed
>> - defintion shortened. e,g. the above class should be changed to
>> margin : 5px 7px 0px 0px;
>> padding : 5px 0px 5px 0px;
>
>
> This is a difficult problem, so difficult that it's impractical. It's
> certainly not possible to do it (usefully) by processing the CSS
> alone.
Good reply. In any case, the quickest and most efficient way to shrink
your CSS is to gzip it. Just as a test, I gzipped the CSS from the
xkcd.com homepage, which brought the filesize down to 893 bytes, from
9048 bytes; a reduction of over 90%. Any further reductions by
'preprocessing' the code will probably be minimal.
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
|