summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-02-17 18:52:03 +0100
committerYorhel <git@yorhel.nl>2010-02-17 18:52:03 +0100
commit59935a4fbb0d2fcee75154d72a4ec06bbd439c29 (patch)
tree0ff08233aac3a4cdb6fa48d69a90d9c395d4a355
parent66b4249b62682eb754d5e3bb4fe66c6dd03b09d5 (diff)
CSS: Refer to all external files with the version as query string
This makes sure that these also get forced reloaded on a version change.
-rw-r--r--data/style.css2
-rwxr-xr-xutil/skingen.pl17
2 files changed, 13 insertions, 6 deletions
diff --git a/data/style.css b/data/style.css
index 50f50689..f74c4544 100644
--- a/data/style.css
+++ b/data/style.css
@@ -1145,7 +1145,7 @@ div#iv_view {
/****** Icons *******/
.icons {
- background: url(/f/icons.png) no-repeat;
+ background: url(/f/icons.png?$version$) no-repeat;
width: 16px;
height: 14px;
margin: 0 2px 0 0;
diff --git a/util/skingen.pl b/util/skingen.pl
index 37504921..343c5922 100755
--- a/util/skingen.pl
+++ b/util/skingen.pl
@@ -1,18 +1,22 @@
#!/usr/bin/perl
+package VNDB;
+
use strict;
use warnings;
use Cwd 'abs_path';
use Image::Magick;
eval { require CSS::Minifier::XS };
-our $ROOT;
+our($ROOT, %S);
BEGIN { ($ROOT = abs_path $0) =~ s{/util/skingen\.pl$}{}; }
use lib "$ROOT/lib";
use SkinFile;
+require $ROOT.'/data/global.pl';
+
sub writeskin { # $name
my $name = shift;
@@ -24,15 +28,15 @@ sub writeskin { # $name
my $path = "/s/$name/$o{imgrighttop}";
my $img = Image::Magick->new;
$img->Read("$ROOT/static$path");
- $o{_bgright} = sprintf 'background: url(%s) no-repeat; width: %dpx; height: %dpx',
- $path, $img->Get('width'), $img->Get('height');
+ $o{_bgright} = sprintf 'background: url(%s?%s) no-repeat; width: %dpx; height: %dpx',
+ $path, $S{version}, $img->Get('width'), $img->Get('height');
} else {
$o{_bgright} = 'display: none';
}
# body background
if($o{imglefttop}) {
- $o{_bodybg} = sprintf 'background: %s url(/s/%s/%s) no-repeat', $o{bodybg}, $name, $o{imglefttop};
+ $o{_bodybg} = sprintf 'background: %s url(/s/%s/%s?%s) no-repeat', $o{bodybg}, $name, $o{imglefttop}, $S{version};
} else {
$o{_bodybg} = sprintf 'background-color: %s', $o{bodybg};
}
@@ -44,7 +48,7 @@ sub writeskin { # $name
my $img = Image::Magick->new(size => '1x1');
$img->Read("xc:$o{boxbg}");
$img->Write(filename => "$ROOT/static/s/$name/boxbg.png");
- $o{_boxbg} = "/s/$name/boxbg.png";
+ $o{_boxbg} = "/s/$name/boxbg.png?$S{version}";
# get the blend color
$img = Image::Magick->new(size => '1x1');
@@ -52,6 +56,9 @@ sub writeskin { # $name
$img = $img->Flatten();
$o{_blendbg} = '#'.join '', map sprintf('%02x', $_*255), $img->GetPixel(x=>1,y=>1);
+ # version
+ $o{version} = $S{version};
+
# write the CSS
open my $CSS, '<', "$ROOT/data/style.css" or die $!;
my $css = join '', <$CSS>;