5 use CSS
::Minifier
::XS qw
//;
7 use JavaScript
::Minifier
::XS qw
//;
9 use File
::Slurp qw
/read_file write_file/;
15 my $maker = Local
::CSS
::SpriteMaker
->new(
16 css_class_prefix
=> 'logo-',
17 rc_override_classname
=> sub {
19 $name =~ s/-light/.logo-light/r;
24 source_images
=> ['logos/'],
25 target_file
=> 'static/logos.png',
26 add_extra_padding
=> 10,
30 filename
=> 'css/logos.css',
31 sprite_filename
=> 'https://static.mindcoding.ro/static/logos.png',
34 system 'pngnq-s9', '-s1', 'static/logos.png';
35 system 'optipng', '-o7', '-zm1-9', 'static/logos-nq8.png';
36 rename 'static/logos-nq8.png', 'static/logos.png';
41 $common_css .= read_file
$_ for <css
/*.css
>;
42 for (<css
/themes/*>) {
43 my ($theme) = m
,themes
/(.*)\
.css
,;
44 my $css = read_file
$_;
46 write_file
"static/css/$theme.css", CSS
::Minifier
::XS
::minify
$css;
51 if (-f
'compiler.jar') {
52 system java
=> -jar
=> 'compiler.jar', qw
,-O SIMPLE
--create_source_map static
/js.map --js_output_file static/js
.js
--language_in ECMASCRIPT5_STRICT
--source_map_location_mapping js
/|/static
/js
/,, <js/*>;
53 my $js = read_file
'static/js.js';
54 write_file
'static/js.js', '//# sourceMappingURL=/static/js.map', "\n", $js;
55 system 'cp', '-rp', 'js', 'static/';
58 $js .= read_file
$_ for <js
/*.js
>;
59 write_file
'static/js.js', JavaScript
::Minifier
::XS
::minify
$js;
63 my $css_mtime = -M
'static/css/slate.css' // 0;
64 for (<css
/*>, <css
/themes
/*>) {
65 if (!$css_mtime || $css_mtime > -M
) {
71 my $js_mtime = -M
'static/js.js' // 0;
73 if (!$js_mtime || $js_mtime > -M
) {
79 my $sprite_mtime = -M
'static/logos.png' // 0;
81 if (!$sprite_mtime || $sprite_mtime > -M
) {
88 Local
::CSS
::SpriteMaker
;
90 use parent qw
/CSS::SpriteMaker/;
92 sub _get_stylesheet_string
{
94 my @ret = split "\n", $self->SUPER::_get_stylesheet_string
(@_);
99 background-image: url("https://static.mindcoding.ro/static/logos.png");
100 background-repeat: no-repeat;
101 display: inline-block;
102 vertical-align: middle;