css minification
Adam D. Ruppe via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jan 17 16:22:41 PST 2015
On Saturday, 17 January 2015 at 20:52:28 UTC, Andrei Alexandrescu
wrote:
> Our webmaster got back. He said compression is more CPU work
> and on a fat pipe (which we do have) that may make things
> actually worse.
Doing it on demand might be a mistake here, but we can also
pre-compress the files since it is a static site.
You just run gzip on the files then serve them up with the proper
headers.
here's a thing about doing it in apache
http://stackoverflow.com/questions/75482/how-can-i-pre-compress-files-with-mod-deflate-in-apache-2-x
> Also, how would this work if we switch to vibe.d? -- Andrei
I don't know about vibe, but it is trivially simple in HTTP, so
if it isn't supported there, it is probably a three (ish) line
change.
Caching is the same deal btw, just set the right header and
you'll get a huge improvement. "Cache-control: max-age=36000"
will cache it for ten hours, without even needing to change the
urls. (Changing urls is nice because you can set it to cache
forever and still get instantly visible updates to the user by
changing the url, but we'd probably be fine with a cache update
lag and it is simpler that way.)
ETags are set right now and that does some caching, it could be
improved further by adding the max-age bit tho.
This is an apache config of some sort too.
http://stackoverflow.com/questions/16750757/apache-set-max-age-or-expires-in-htaccess-for-directory
though I don't agree it should be one year unless we're using
different urls, we should do hours or days, but that's how it is
done.
More information about the Digitalmars-d
mailing list