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 'optipng', '-o7', '-zm1-9', 'static/logos.png';
39 $common_css .= read_file
$_ for <css
/*.css
>;
40 for (<css
/themes/*>) {
41 my ($theme) = m
,themes
/(.*)\
.css
,;
42 my $css = read_file
$_;
44 write_file
"static/css/$theme.css", CSS
::Minifier
::XS
::minify
$css;
49 if (-f
'compiler.jar') {
50 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/*>;
51 my $js = read_file
'static/js.js';
52 write_file
'static/js.js', '//# sourceMappingURL=/static/js.map', "\n", $js;
53 system 'cp', '-rp', 'js', 'static/';
56 $js .= read_file
$_ for <js
/*.js
>;
57 write_file
'static/js.js', JavaScript
::Minifier
::XS
::minify
$js;
61 my $css_mtime = -M
'static/css/slate.css' // 0;
62 for (<css
/*>, <css
/themes
/*>) {
63 if (!$css_mtime || $css_mtime > -M
) {
69 my $js_mtime = -M
'static/js.js' // 0;
71 if (!$js_mtime || $js_mtime > -M
) {
77 my $sprite_mtime = -M
'static/logos.png' // 0;
79 if (!$sprite_mtime || $sprite_mtime > -M
) {
86 Local
::CSS
::SpriteMaker
;
88 use parent qw
/CSS::SpriteMaker/;
90 sub _get_stylesheet_string
{
92 my @ret = split "\n", $self->SUPER::_get_stylesheet_string
(@_);
97 background-image: url("https://static.mindcoding.ro/static/logos.png");
98 background-repeat: no-repeat;
99 display: inline-block;
100 vertical-align: middle;