Changed the build process it generates a devel and a prod version

of the source, added some screenshots and a sample printout, couple
bugfixes.
This commit is contained in:
git@daemon.de
2013-09-14 13:14:06 +02:00
parent 81aa7e83e4
commit 10e5d547f3
25 changed files with 56118 additions and 50 deletions

View File

@@ -3,14 +3,14 @@ use Data::Dumper;
use JavaScript::Minifier qw(minify);
use CSS::Compressor qw( css_compress );
my $index = shift;
my ($type, $index) = @ARGV;
if (!$index) {
print STDERR "Usage: $0 <index.html>\n";
print STDERR "Usage: $0 <prod|dev> <index.html>\n";
exit 1;
}
my $out = "digiproof.html";
my $out = "digiproof-$type.html";
print STDERR "open index\n";
open I, "<$index" or die "Could not open index: $index $!\n";
@@ -38,6 +38,9 @@ foreach (@source) {
}
elsif (/script src="([^"]*)"/) {
my $jsfile = $1;
if ($jsfile =~ /localstorage/) {
$jsfile = "js/libs/localstorage_adapter_$type.js";
}
print STDERR "Inserting $jsfile\n";
print qq(<script type="text/javascript">\n);
print &fetch($jsfile);
@@ -55,16 +58,30 @@ sub fetch {
my $file = shift;
open F, "<$file" or die "Could not open index: $file $!\n";
if($file =~ /\.js/) {
my $js = minify(input => *F);
# ember.js (and probably others) contain strings which contain </script>
# which leads to rendering failures, those will be fixed here
$js =~ s/<\/script>/' + Slash + 'script>/g;
close F;
return "/* js from $file */\n" . $js;
my $js;
my $from = "/* js from $file */\n";
if ($type eq 'prod') {
$js = minify(input => *F);
# ember.js (and probably others) contain strings which contain </script>
# which leads to rendering failures, those will be fixed here
$js =~ s/<\/script>/' + Slash + 'script>/g;
close F;
return $from . $js;
}
else {
return $from . join '', <F>;
close F;
}
}
else {
my $from = "/* css from $file */\n";
my $src = join "", <F>;
close F;
return "/* css from $file */\n" . css_compress($src);
if ($prod) {
return $from . $src;
}
else {
return $from . css_compress($src);
}
}
}