]> iEval git - gruntmaster-page.git/commitdiff
Add rudimentary closure compiler support
authorMarius Gavrilescu <marius@ieval.ro>
Sun, 8 Mar 2015 10:15:32 +0000 (12:15 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sun, 8 Mar 2015 10:15:32 +0000 (12:15 +0200)
Makefile.PL
make_static.PL

index 2f3a50f2784e73f70334031e465446dc62ca0723..021ffdb4b64c3f5d11be11c3229c13deea10c95a 100644 (file)
@@ -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
index a47df2d8511d289c6ca62eee73a9bd5fe06ccd69..fe06da94e4a10cadfca343d5fc8b06fa05e9a070 100644 (file)
@@ -19,6 +19,13 @@ for (<css/themes/*>) {
        write_file "static/css/$theme.css", CSS::Minifier::XS::minify $css;
 }
 
-my $js;
-$js .= read_file $_ for <js/*.js>;
-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/,, <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 <js/*.js>;
+       write_file 'static/js.js', JavaScript::Minifier::XS::minify $js;
+}
This page took 0.03157 seconds and 4 git commands to generate.