From: Marius Gavrilescu Date: Sun, 8 Mar 2015 10:15:32 +0000 (+0200) Subject: Add rudimentary closure compiler support X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;ds=sidebyside;h=9cad7bdddc585fce8efed182c91634b2b7e9e354;p=gruntmaster-page.git Add rudimentary closure compiler support --- diff --git a/Makefile.PL b/Makefile.PL index 2f3a50f..021ffdb 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -10,7 +10,7 @@ WriteMakefile( LICENSE => 'AGPL_3', SIGN => 1, clean => { - FILES => 'static/css/ static/js.js' + FILES => 'static/css/ static/js.js static/js.map static/js/' }, BUILD_REQUIRES => { qw/CSS::Minifier::XS 0 diff --git a/make_static.PL b/make_static.PL index a47df2d..fe06da9 100644 --- a/make_static.PL +++ b/make_static.PL @@ -19,6 +19,13 @@ for () { write_file "static/css/$theme.css", CSS::Minifier::XS::minify $css; } -my $js; -$js .= read_file $_ for ; -write_file 'static/js.js', JavaScript::Minifier::XS::minify $js; +if (-f 'compiler.jar') { + 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/,, ; + my $js = read_file 'static/js.js'; + write_file 'static/js.js', '//# sourceMappingURL=/static/js.map', "\n", $js; + system 'cp', '-rp', 'js', 'static/'; +} else { + my $js; + $js .= read_file $_ for ; + write_file 'static/js.js', JavaScript::Minifier::XS::minify $js; +}