CSSMin: Do not base64-encode non-binary files when embedding
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 17 Sep 2014 21:14:46 +0000 (23:14 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 30 Sep 2014 21:13:42 +0000 (23:13 +0200)
commitfa223d65d6293170b25a81770ae943936ffb7589
tree03a541eebe8d7573f3351abf335b85a748b4d522
parent18a9e7c4090d6f3763e17131a59da277664cba2d
CSSMin: Do not base64-encode non-binary files when embedding

Do not base64-encode non-binary files (containing only whitespace and
printable ASCII characters, which matches sane SVG files).

For SVG files the percent-encoded URIs are actually slightly longer
than the base64-encoded ones (~10%), but compress a lot better
resulting on 15-20% less data to transfer after gzip compression.

(The effect is best seen on the 'oojs-ui' module, which consists
mostly of SVG icons – especially after commenting out everything other
than 'oojs-ui.svg.css'.)

I tried this for binary files too, just in case; but as expected, they
suffer from a noticeable size increase even with compression (~15%).

Bug: 67341
Change-Id: Iddaf863b6be98570a2bb8e606f13946a96345f65
RELEASE-NOTES-1.25
includes/libs/CSSMin.php
tests/phpunit/data/cssmin/circle.svg [new file with mode: 0644]
tests/phpunit/includes/libs/CSSMinTest.php