diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | data/config_example.pl | 7 | ||||
-rwxr-xr-x | util/spritegen.pl | 11 |
4 files changed, 9 insertions, 19 deletions
@@ -9,6 +9,7 @@ /elm3/Lib/Gen.elm /static/f/js/ /static/f/icons.png +/static/f/icons.opt.png /static/f/vndb.js /static/f/vndb.min.js /static/f/vndb.min.js.gz @@ -20,7 +20,7 @@ # other environments. Patches to improve the portability are always welcome. -.PHONY: all chmod multi-stop multi-start multi-restart +.PHONY: all prod chmod multi-stop multi-start multi-restart ALL_KEEP=\ static/ch static/cv static/sf static/st \ @@ -41,6 +41,7 @@ PROD=\ static/v3/min.js static/v3/min.js.gz \ static/v3/min.css static/v3/min.css.gz \ static/f/vndb.min.js static/f/vndb.min.js.gz \ + static/f/icons.opt.png \ $(shell ls static/s | sed -e 's/\(.\+\)/static\/s\/\1\/style.min.css/g') \ $(shell ls static/s | sed -e 's/\(.\+\)/static\/s\/\1\/style.min.css.gz/g') @@ -85,8 +86,12 @@ static/f/vndb.js: data/js/*.js util/jsgen.pl data/config.pl data/global.pl | sta static/f/vndb.min.js: static/f/vndb.js uglifyjs $< --compress --mangle -o $@ -data/icons/icons.css: data/icons/*.png data/icons/*/*.png util/spritegen.pl | static/f +data/icons/icons.css static/f/icons.png: data/icons/*.png data/icons/*/*.png util/spritegen.pl | static/f util/spritegen.pl +static/f/icons.png: data/icons/icons.css + +static/f/icons.opt.png: static/f/icons.png + zopflipng -m --lossy_transparent $< $@ static/s/%/style.css: static/s/%/conf util/skingen.pl data/style.css data/icons/icons.css util/skingen.pl $* diff --git a/data/config_example.pl b/data/config_example.pl index df48f5ef..30731d08 100644 --- a/data/config_example.pl +++ b/data/config_example.pl @@ -39,10 +39,3 @@ $M{db_login} = { dbname => 'vndb', user => 'vndb_multi', password => 'vndb_multi # pass => '<nickserv-password>', # masters => [ 'yorhel!~Ayo@your.hell' ], #}; - - -# Uncomment to generate an extra small icons.png -# (note: using zopflipng or pngcrush with the slow option is *really* slow, but compresses awesomely) -#$SPRITEGEN{crush} = '/usr/bin/pngcrush -q'; -#$SPRITEGEN{crush} = '/usr/bin/zopflipng -m --lossy_transparent'; -#$SPRITEGEN{slow} = 1; diff --git a/util/spritegen.pl b/util/spritegen.pl index e8b60017..5b2b5982 100755 --- a/util/spritegen.pl +++ b/util/spritegen.pl @@ -1,7 +1,5 @@ #!/usr/bin/perl -package VNDB; - use strict; use warnings; use Image::Magick; @@ -9,7 +7,6 @@ use Cwd 'abs_path'; our $ROOT; BEGIN { ($ROOT = abs_path $0) =~ s{/util/spritegen\.pl$}{}; } -require $ROOT.'/data/global.pl'; my $path = "$ROOT/data/icons"; my $icons = "$ROOT/static/f/icons.png"; @@ -86,8 +83,7 @@ sub minstrip { my($optsize, $w, $h, $optw, $opth) = (1e9, $maxwidth); while($w >= $minwidth) { ($w, $h) = genstrip($w); - # Optimize for file size rather than pixel count if slow is set - my $size = $VNDB::SPRITEGEN{slow} ? img($w, $h) : $w*$h; + my $size = $w*$h; if($size < $optsize) { $optw = $w; $opth = $h; @@ -111,11 +107,6 @@ sub img { print $img->Write("png32:$ticons"); undef $img; - if($VNDB::SPRITEGEN{crush}) { - `$VNDB::SPRITEGEN{crush} "$ticons" "$ticons~"`; - rename "$ticons~", $ticons or die $!; - } - my $size = -s $ticons; #printf "Dim: %dx%d, size: %d, pixels wasted: %d\n", $w, $h, $size, $w*$h-$minpixels; $size; |