summaryrefslogtreecommitdiff
path: root/util/skingen.pl
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2016-01-03 20:43:54 +0100
committerYorhel <git@yorhel.nl>2016-01-10 09:21:29 +0100
commit2a62230db34e26ea8c4182754470252b872131bd (patch)
tree39ad6a707a8d9afa50d63032ba5b9467975f6371 /util/skingen.pl
parent3fa146962f64c2a12235ca9fc08b249b2bfc29ac (diff)
Support zopfli/zopflipng for all static asset generators
Compresses a little better. I reduced the number of iterations required to find the optimal image size in spritegen.pl, but generating the icons.png is *incredibly slow* when combining zopflipng with the 'slow' option. It's possible to parallelize the calculation and use multiple cores to speed it up, but that seems overkill. Some icons.png compression stats: METHOD SIZE RUNTIME default 18103 <1sec slow 17941 few secs pngcrush 15385 <1sec pngcrush+slow 15148 few mins zopflipng 14986 few secs zopflipng+slow 14898 ~1 hour
Diffstat (limited to 'util/skingen.pl')
-rwxr-xr-xutil/skingen.pl8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/skingen.pl b/util/skingen.pl
index 834578cb..aa5db2d5 100755
--- a/util/skingen.pl
+++ b/util/skingen.pl
@@ -72,9 +72,15 @@ sub writeskin { # $name
my $css = join '', <$CSS>;
close $CSS;
$css =~ s/\$$_\$/$o{$_}/g for (keys %o);
- open my $SKIN, '>', "$ROOT/static/s/$name/style.css" or die $!;
+
+ my $f = "$ROOT/static/s/$name/style.css";
+ open my $SKIN, '>', "$f~" or die $!;
print $SKIN $CSS::Minifier::XS::VERSION ? CSS::Minifier::XS::minify($css) : $css;
close $SKIN;
+
+ rename "$f~", $f;
+
+ `$VNDB::SKINGEN{gzip} -c '$f' >'$f.gz'` if $VNDB::SKINGEN{gzip};
}