SVG

Photo Credit: hoangkim.tk

SVG

Hoàng Kim Tân Kỳ bio photo By Hoàng Kim Tân Kỳ Comment

I am quite interested in SVG technology because it is very compact in contrast to normal image formats. But it is only suitable for certain type of images. In this post I’ll test whether GitHub server can host it. There are two types of SVG, the normal svg and the compressed svgz. In my case the sizes are about 36kb and 3k.

How it should be

Normal image

svg

Compressed image

svgz

GitHub

Normal image

svg

Compressed image

svgz

Result

GitHub cannot host compressed svgz. But it should be enough, because the site is normally compressed before sending to the user.

To use external resources I added resources to _config.yml, which is pointing to the location of my resources. Now I can use this for bigger files without stressing my GitHub too much.

The reason why svgz can be displayed is because I can modify .htaccess. People would think .htaccess was not important on GitHub because it is public anyway, but you can use it for other purposes! Here is the content of my .htaccess file in the resource folder:

AddType image/svg+xml svg
AddType image/svg+xml svgz
AddEncoding x-gzip .svgz

The 1st line can be omitted if svg is already supported. If you have an idea how to use something like .htaccess on GitHub, please let me know!