css minification

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 17 10:00:02 PST 2015


On 1/17/15 8:44 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm at gmx.net>" 
wrote:
> On Friday, 16 January 2015 at 22:32:07 UTC, Steven Schveighoffer wrote:
>> On 1/16/15 5:23 PM, Andrei Alexandrescu wrote:
>>> On 1/16/15 1:44 PM, Steven Schveighoffer wrote:
>>>> On an embedded product we have with a dead-simple web server, there is
>>>> terrible network performance. Adding gzip support saved way more than
>>>> minification ever could. But the best performance improvement was to
>>>> add
>>>> caching support to the server. Both the browser and the server have to
>>>> cooperate there.
>>>
>>> Pretty cool. The problem I'm having right now is the following pattern:
>>>
>>> 1. I have a mini-idea that takes me minutes to implement and turns the
>>> ratchet in the right direction.
>>
>> At the cost of adding dependencies for builds, and requiring builds be
>> done with Internet access. I don't think it's out of line to ask that
>> if we are going to add extra build requirements, we should make sure
>> it's really making decent progress.
>>
>
> Why do we need an external services?
>
>      cat style.css |
>          tr '\n' ' ' |
>          sed 's/\/\*[^*]*\*\///g' |
>          sed 's/\s\+/ /g' |
>          sed 's/ \?\([(){},;]\) \?/\1/g
>
> Strictly speaking, this is overzealous (e.g. it also operates inside
> strings), and I didn't even test it, but it will probably work for
> almost all cases. The current main CSS file of dlang.org (style.css)
> shrinks from 14757 to 11720 bytes, a reduction of ~21%.
>
> But even writing a compressor in D should be trivial, as you'd only need
> a lexer.

Would be a nice tools/ thing. Wanna do it/ --- Andrei




More information about the Digitalmars-d mailing list