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
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 <css/*.css>;