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
+++ /dev/null
-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; }
use warnings;
use CSS::Minifier::XS qw//;
+use CSS::SpriteMaker;
use JavaScript::Minifier::XS qw//;
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/*>) {
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;
+}