From 04a09990050cf6f330a15ec2016059e535ef4988 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 23 Dec 2022 18:42:53 +0100 Subject: [PATCH] Remove a bunch of unneeded whitespace from the SVGs. 642 fewer gzipped bytes, for basically no cost. --- clean-svg.pl | 19 +++++++++++++++++++ www/js/remoteglot.js | 24 ++++++++++++------------ 2 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 clean-svg.pl diff --git a/clean-svg.pl b/clean-svg.pl new file mode 100644 index 0000000..c74321d --- /dev/null +++ b/clean-svg.pl @@ -0,0 +1,19 @@ +#! /usr/bin/perl +use strict; +use warnings; +use MIME::Base64; + +undef $/; +my $x = <>; +$x = MIME::Base64::decode_base64($x); +$x =~ s/>\s*#/>#g; # -> . +$x =~ s/;\s+/;/sg; # Remove whitespace in CSS. +$x =~ s/;"/"/g; # Remove final semicolon in CSS. +$x =~ s/\s+$//; # Remove tailing whitespace. +$x =~ s/>\n