summaryrefslogtreecommitdiff
path: root/util/skingen.pl
diff options
context:
space:
mode:
Diffstat (limited to 'util/skingen.pl')
-rwxr-xr-xutil/skingen.pl18
1 files changed, 5 insertions, 13 deletions
diff --git a/util/skingen.pl b/util/skingen.pl
index e27ea4a1..73e4fdc7 100755
--- a/util/skingen.pl
+++ b/util/skingen.pl
@@ -5,13 +5,12 @@ package VNDB;
use strict;
use warnings;
use Cwd 'abs_path';
-use Data::Dumper 'Dumper';
use Image::Magick;
+eval { require CSS::Minifier::XS };
our($ROOT, %O);
BEGIN { ($ROOT = abs_path $0) =~ s{/util/skingen\.pl$}{}; }
-require $ROOT.'/data/global.pl';
if(@ARGV) {
@@ -78,19 +77,12 @@ sub writeskin { # $obj
# write the CSS
open my $CSS, '<', "$ROOT/data/style.css" or die $!;
+ my $css = join '', <$CSS>;
+ close $CSS;
+ $css =~ s/\$$_\$/$o->{$_}/g for (keys %$o);
open my $SKIN, '>', "$ROOT/static/s/$o->{_name}/style.css" or die $!;
- while((my $d = <$CSS>)) {
- if($O{debug}) {
- chomp $d;
- $d =~ s/^\s*/ /;
- $d =~ s{/\*.+\*/}{}; # NOTE: multiline comments or multiple comments per line won't work
- next if $d !~ /[^\s\t]/;
- }
- $d =~ s/\$$_\$/$o->{$_}/g for (keys %$o);
- print $SKIN $d;
- }
+ print $SKIN $CSS::Minifier::XS::VERSION ? CSS::Minifier::XS::minify($css) : $css;
close $SKIN;
- close $CSS;
}