]>
Commit | Line | Data |
---|---|---|
8798626b MG |
1 | #!/usr/bin/perl |
2 | use v5.14; | |
3 | use warnings; | |
4 | ||
5 | use CSS::Minifier::XS qw//; | |
6 | use JavaScript::Minifier::XS qw//; | |
7 | ||
8 | use File::Slurp qw/read_file write_file/; | |
9 | ||
10 | mkdir 'static'; | |
11 | mkdir 'static/css'; | |
12 | ||
13 | my $common_css; | |
14 | $common_css .= read_file $_ for <css/*.css>; | |
15 | for (<css/themes/*>) { | |
16 | my ($theme) = m,themes/(.*)\.css,; | |
17 | my $css = read_file $_; | |
18 | $css .= $common_css; | |
19 | write_file "static/css/$theme.css", CSS::Minifier::XS::minify $css; | |
20 | } | |
21 | ||
9cad7bdd MG |
22 | if (-f 'compiler.jar') { |
23 | 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/*>; | |
24 | my $js = read_file 'static/js.js'; | |
25 | write_file 'static/js.js', '//# sourceMappingURL=/static/js.map', "\n", $js; | |
26 | system 'cp', '-rp', 'js', 'static/'; | |
27 | } else { | |
28 | my $js; | |
29 | $js .= read_file $_ for <js/*.js>; | |
30 | write_file 'static/js.js', JavaScript::Minifier::XS::minify $js; | |
31 | } |