+
+sub make_css {
+ my %css;
+ $css{common} .= read_file $_ for <css/*.css>;
+
+ my (%themes, $rndtheme);
+ for (<css/themes/*>) {
+ ($rndtheme) = m,themes/(.*)\.css,;
+ $themes{$rndtheme} = read_css_into_blocks $_;
+ }
+
+ while (grep { scalar @$_ } values %themes) {
+ my %blocks = map { $_ => (shift @{$themes{$_}}) // '' } keys %themes;
+ if (grep { $_ ne $blocks{$rndtheme} } values %blocks) {
+ $css{$_} .= $blocks{$_} for keys %themes;
+ } else {
+ $css{common} .= $blocks{$rndtheme};
+ }
+ }
+
+ write_gzfile "static/css/$_.css", minify $css{$_} for keys %css
+}
+
+sub make_js {
+ system java => -jar => 'compiler.jar', qw,-O SIMPLE --create_source_map static/js/js.map --js_output_file static/js/all.js --language_in ECMASCRIPT6_STRICT --language_out ECMASCRIPT5_STRICT --source_map_location_mapping js/|/static/js/,, <js/*>;
+ my $js = read_file 'static/js/all.js';
+ write_gzfile 'static/js/all.js', '//# sourceMappingURL=/static/js/js.map', "\n", $js;
+ system 'cp', '-rp', 'js', 'static/';