5 use CSS
::Minifier
::XS qw
//;
6 use JavaScript
::Minifier
::XS qw
//;
8 use IO
::Compress
::Gzip qw
/gzip/;
9 use File
::Slurp qw
/read_file write_file/;
16 gzip
$file => "$file.gz", -Level
=> 9, Minimal
=> 1;
21 $common_css .= read_file
$_ for <css
/*.css
>;
22 for (<css
/themes/*>) {
23 my ($theme) = m
,themes
/(.*)\
.css
,;
24 my $css = read_file
$_;
26 write_file
"static/css/$theme.css", CSS
::Minifier
::XS
::minify
$css;
27 gzip_file
"static/css/$theme.css";
32 if (-f
'compiler.jar') {
33 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/*>;
34 my $js = read_file
'static/js.js';
35 write_file
'static/js.js', '//# sourceMappingURL=/static/js.map', "\n", $js;
36 system 'cp', '-rp', 'js', 'static/';
39 $js .= read_file
$_ for <js
/*.js
>;
40 write_file
'static/js.js', JavaScript
::Minifier
::XS
::minify
$js;
42 gzip_file
'static/js.js';
45 my $css_mtime = -M
'static/css/slate.css' // 0;
46 for (<css
/*>, <css
/themes
/*>) {
47 if (!$css_mtime || $css_mtime > -M
) {
53 my $js_mtime = -M
'static/js.js' // 0;
55 if (!$js_mtime || $js_mtime > -M
) {