From: Marius Gavrilescu Date: Thu, 2 Apr 2015 08:11:59 +0000 (+0300) Subject: Merge branch 'master' into newmc X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=b0201bcc83ed8e81b0842e06c282386fd0d0ed85;p=plack-app-gruntmaster.git Merge branch 'master' into newmc Conflicts: Makefile.PL make_static.PL --- b0201bcc83ed8e81b0842e06c282386fd0d0ed85 diff --cc Makefile.PL index 2b025b1,6da9ecf..6f86eb4 --- a/Makefile.PL +++ b/Makefile.PL @@@ -10,7 -10,7 +10,7 @@@ WriteMakefile LICENSE => 'AGPL_3', SIGN => 1, clean => { - FILES => 'static/css/ static/js.js css/logos.css static/logos.png static/js.map static/js/' - FILES => 'static/css/ static/js.js static/js.js.gz static/js.map static/js/' ++ FILES => 'static/css/ static/js.js static/js.js.gz css/logos.css static/logos.png static/js.map static/js/' }, BUILD_REQUIRES => { qw/CSS::Minifier::XS 0 diff --cc make_static.PL index 489652a,10532b9..4d737fa --- a/make_static.PL +++ b/make_static.PL @@@ -3,39 -3,19 +3,45 @@@ use v5.14 use warnings; use CSS::Minifier::XS qw//; +use CSS::SpriteMaker; use JavaScript::Minifier::XS qw//; + use IO::Compress::Gzip qw/gzip/; use File::Slurp qw/read_file write_file/; mkdir 'static'; mkdir 'static/css'; +sub make_sprite { + 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 => '/static/logos.png', + ); + + system 'pngnq-s9', '-s1', 'static/logos.png'; + system 'optipng', '-o7', '-zm1-9', 'static/logos-nq8.png'; + rename 'static/logos-nq8.png', 'static/logos.png'; +} + + sub gzip_file { + my ($file) = @_; + gzip $file => "$file.gz", -Level => 9, Minimal => 1; + } + sub make_css { my $common_css; $common_css .= read_file $_ for ;