]> iEval git - gruntmaster-page.git/commitdiff
Make sprites during build
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 2 Mar 2015 16:05:23 +0000 (18:05 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 2 Mar 2015 16:05:23 +0000 (18:05 +0200)
22 files changed:
Makefile.PL
css/logos.css [deleted file]
logos/bigstep.png [new file with mode: 0644]
logos/bosch.jpg [new file with mode: 0644]
logos/cos.png [new file with mode: 0644]
logos/csf.png [new file with mode: 0644]
logos/easyhost.png [new file with mode: 0644]
logos/emag.png [new file with mode: 0644]
logos/endava.jpg [new file with mode: 0644]
logos/eyc.png [new file with mode: 0644]
logos/facebook.png [new file with mode: 0644]
logos/hermes-light.png [new file with mode: 0644]
logos/hermes.png [new file with mode: 0644]
logos/spyhce.png [new file with mode: 0644]
logos/takeofflabs-light.png [new file with mode: 0644]
logos/takeofflabs.png [new file with mode: 0644]
logos/telenav.png [new file with mode: 0644]
logos/usr.png [new file with mode: 0644]
logos/yardi-light.png [new file with mode: 0644]
logos/yardi.png [new file with mode: 0644]
make_static.PL
static/logos.png [deleted file]

index 2f3a50f2784e73f70334031e465446dc62ca0723..c6d91a7941b776c7dff59e561878c6654affd84d 100644 (file)
@@ -10,10 +10,11 @@ WriteMakefile(
        LICENSE           => 'AGPL_3',
        SIGN              => 1,
        clean             => {
-               FILES => 'static/css/ static/js.js'
+               FILES => 'static/css/ static/js.js css/logos.css static/logos.png'
        },
        BUILD_REQUIRES    => {
                qw/CSS::Minifier::XS          0
+                  CSS::SpriteMaker           0
                   File::Slurp                0
                   JavaScript::Minifier::XS   0
                   Test::MockTime             0
diff --git a/css/logos.css b/css/logos.css
deleted file mode 100644 (file)
index 9f7bf21..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-a.logo {
-       background-image: url("https://static.mindcoding.ro/static/logos.png");
-       background-repeat: no-repeat;
-       display: inline-block;
-       vertical-align: middle;
-}
-
-.logo-bigstep { background-position: -5px -0px; width: 250px; height: 72px; }
-.logo-bosch { background-position: -5px -77px; width: 250px; height: 75px; }
-.logo-cos { background-position: -5px -937px; width: 212px; height: 53px; }
-.logo-csf { background-position: -5px -812px; width: 220px; height: 120px; }
-.logo-easyhost { background-position: -5px -157px; width: 250px; height: 59px; }
-.logo-emag { background-position: -5px -221px; width: 250px; height: 83px; }
-.logo-endava { background-position: -5px -309px; width: 250px; height: 86px; }
-.logo-eyc { background-position: -5px -1217px; width: 166px; height: 53px; }
-.logo-facebook { background-position: -5px -1275px; width: 111px; height: 111px; }
-.logo-hermes { background-position: -5px -1111px; width: 192px; height: 101px; }
-.logo-hermes.logo-light { background-position: -5px -995px; width: 200px; height: 111px; }
-.logo-spyhce { background-position: -5px -400px; width: 250px; height: 95px; }
-.logo-takeofflabs { background-position: -5px -556px; width: 250px; height: 51px; }
-.logo-takeofflabs.logo-light { background-position: -5px -500px; width: 250px; height: 51px; }
-.logo-telenav { background-position: -5px -612px; width: 250px; height: 67px; }
-.logo-usr { background-position: -121px -1275px; width: 105px; height: 52px; }
-.logo-yardi { background-position: -5px -750px; width: 234px; height: 57px; }
-.logo-yardi.logo-light { background-position: -5px -684px; width: 250px; height: 61px; }
diff --git a/logos/bigstep.png b/logos/bigstep.png
new file mode 100644 (file)
index 0000000..3ee4d6b
Binary files /dev/null and b/logos/bigstep.png differ
diff --git a/logos/bosch.jpg b/logos/bosch.jpg
new file mode 100644 (file)
index 0000000..ecd2fbe
Binary files /dev/null and b/logos/bosch.jpg differ
diff --git a/logos/cos.png b/logos/cos.png
new file mode 100644 (file)
index 0000000..371fb2c
Binary files /dev/null and b/logos/cos.png differ
diff --git a/logos/csf.png b/logos/csf.png
new file mode 100644 (file)
index 0000000..2193176
Binary files /dev/null and b/logos/csf.png differ
diff --git a/logos/easyhost.png b/logos/easyhost.png
new file mode 100644 (file)
index 0000000..3a25808
Binary files /dev/null and b/logos/easyhost.png differ
diff --git a/logos/emag.png b/logos/emag.png
new file mode 100644 (file)
index 0000000..1fbbe48
Binary files /dev/null and b/logos/emag.png differ
diff --git a/logos/endava.jpg b/logos/endava.jpg
new file mode 100644 (file)
index 0000000..9e49b07
Binary files /dev/null and b/logos/endava.jpg differ
diff --git a/logos/eyc.png b/logos/eyc.png
new file mode 100644 (file)
index 0000000..a203b2f
Binary files /dev/null and b/logos/eyc.png differ
diff --git a/logos/facebook.png b/logos/facebook.png
new file mode 100644 (file)
index 0000000..cd2d5f7
Binary files /dev/null and b/logos/facebook.png differ
diff --git a/logos/hermes-light.png b/logos/hermes-light.png
new file mode 100644 (file)
index 0000000..2e2e417
Binary files /dev/null and b/logos/hermes-light.png differ
diff --git a/logos/hermes.png b/logos/hermes.png
new file mode 100644 (file)
index 0000000..fc8e791
Binary files /dev/null and b/logos/hermes.png differ
diff --git a/logos/spyhce.png b/logos/spyhce.png
new file mode 100644 (file)
index 0000000..fdaa0d3
Binary files /dev/null and b/logos/spyhce.png differ
diff --git a/logos/takeofflabs-light.png b/logos/takeofflabs-light.png
new file mode 100644 (file)
index 0000000..ce72061
Binary files /dev/null and b/logos/takeofflabs-light.png differ
diff --git a/logos/takeofflabs.png b/logos/takeofflabs.png
new file mode 100644 (file)
index 0000000..e0efc97
Binary files /dev/null and b/logos/takeofflabs.png differ
diff --git a/logos/telenav.png b/logos/telenav.png
new file mode 100644 (file)
index 0000000..26fc522
Binary files /dev/null and b/logos/telenav.png differ
diff --git a/logos/usr.png b/logos/usr.png
new file mode 100644 (file)
index 0000000..05ae579
Binary files /dev/null and b/logos/usr.png differ
diff --git a/logos/yardi-light.png b/logos/yardi-light.png
new file mode 100644 (file)
index 0000000..d99f4dd
Binary files /dev/null and b/logos/yardi-light.png differ
diff --git a/logos/yardi.png b/logos/yardi.png
new file mode 100644 (file)
index 0000000..cde5d87
Binary files /dev/null and b/logos/yardi.png differ
index a47df2d8511d289c6ca62eee73a9bd5fe06ccd69..5594f75d81b12b19132918f1f06e4ef05b84a90d 100644 (file)
@@ -3,6 +3,7 @@ use v5.14;
 use warnings;
 
 use CSS::Minifier::XS qw//;
+use CSS::SpriteMaker;
 use JavaScript::Minifier::XS qw//;
 
 use File::Slurp qw/read_file write_file/;
@@ -10,6 +11,25 @@ use File::Slurp qw/read_file write_file/;
 mkdir 'static';
 mkdir 'static/css';
 
+my $maker = Local::CSS::SpriteMaker->new(
+       css_class_prefix => 'logo-',
+       rc_override_classname => sub {
+               my ($name) = @_;
+               $name =~ s/-light/.logo-light/r;
+       }
+);
+
+$maker->make_sprite(
+       source_images     => ['logos/'],
+       target_file       => 'static/logos.png',
+       add_extra_padding => 10,
+);
+
+$maker->print_css(
+       filename        => 'css/logos.css',
+       sprite_filename => 'https://static.mindcoding.ro/static/logos.png',
+);
+
 my $common_css;
 $common_css .= read_file $_ for <css/*.css>;
 for (<css/themes/*>) {
@@ -22,3 +42,24 @@ for (<css/themes/*>) {
 my $js;
 $js .= read_file $_ for <js/*.js>;
 write_file 'static/js.js', JavaScript::Minifier::XS::minify $js;
+
+package
+  Local::CSS::SpriteMaker;
+
+use parent qw/CSS::SpriteMaker/;
+
+sub _get_stylesheet_string {
+       my $self = shift;
+       my @ret = split "\n", $self->SUPER::_get_stylesheet_string(@_);
+       shift @ret;
+       @ret = sort @ret;
+       unshift @ret, <<EOF;
+a.logo {
+       background-image: url("https://static.mindcoding.ro/static/logos.png");
+       background-repeat: no-repeat;
+       display: inline-block;
+       vertical-align: middle;
+}
+EOF
+       join "\n", @ret;
+}
diff --git a/static/logos.png b/static/logos.png
deleted file mode 100644 (file)
index e1d1e8c..0000000
Binary files a/static/logos.png and /dev/null differ
This page took 0.039283 seconds and 4 git commands to generate.