Re: proposal: css compression via aliasing

Hi,

While the idea could look interesting at first glance, it is not - in practice - worth deploying.

The reason for this is that, after application of the DEFLATE algorithm (which every web server is using to transmit text files nowadays) the saving will be close to zero, because this is already how DEFLATE works. There’s basically no need to integrate a compression algorithm in CSS because its redundency is already handled correctly by the existing compression algorithms.

I hope this helps,
François



From: Joey Bradshaw 
Sent: Tuesday, September 10, 2013 8:14 AM
To: www-style@w3.org 
Subject: proposal: css compression via aliasing
I’d like to propose a fairly simple compression specification for the next revision of CSS. Statistics show that the majority of users to any site will have an empty cache calling for a full down of assets like CSS. With the proliferation of vendor specific prefixes along with CSS 2.1 it is very easy to reach large file sizes (100+KB) causing an unnecessary bite into bandwidth especially for “smart” hand held devices. GZip compression and white-space removal goes a long way to reduce file size but a specification for further size reduction like below would cut sizes down dramatically.

 

The proposal is simply to compress CSS via aliasing. Take for example this common CSS (124 characters):

.myClass {

font-size: 35px;

font-weight: 700;

display: inline-block;

vertical-align: middle;

padding: 5px;

position: relative;

}

 

This could become the following through aliasing (47 characters):

.myClass {

fs: 35px;

fw: 700;

d: ib;

va: m;

p1: 5px;

p2: r;

}

 

Results:

Original: 124 characters

Aliased: 47 characters

Savings: 62%

 

The aliases don’t need to be human readable, just unique in context, and should be restricted to two characters if possible. Browsers that implement the specification will simply map the alias and perform the same actions as their full counterparts. Web developers can simply run their CSS through a program that follows the alias specification to produce the aliased version before publishing to the production web site. A browser header could be used to determine if a web site should serve an aliased CSS file versus a non-aliased one for browsers that lack the support for this new specification.

 

Thanks,

Joey

Received on Wednesday, 9 October 2013 12:08:48 UTC