-#!/usr/bin/perl
+#!/usr/bin/env perl
#
use strict;
use warnings;
-use CSS::Minifier::XS;
+use CSS::Minifier::XS 0.07;
use File::Copy;
use File::Find;
use File::Slurp;
## Add the exim-html-current symlink
print "Symlinking exim-html-current to exim-html-$opt{latest}\n";
-symlink( "$opt{docroot}/exim-html-$opt{latest}", "$opt{docroot}/exim-html-current" );
+unlink("$opt{docroot}/exim-html-current") if ( -l "$opt{docroot}/exim-html-current" );
+symlink( "exim-html-$opt{latest}", "$opt{docroot}/exim-html-current" )
+ || die "symlink to $opt{docroot}/exim-html-current failed";
## Generate the website files
sub do_web {
if ( $path =~ /(.+)\.css$/ ) {
print "CSS to : docroot:/$path\n";
my $content = read_file("$opt{tmpl}/web/$path");
- my $output = $opt{minify} ? CSS::Minifier::XS::minify($content) : $content;
- $output =~ s/and\(/and (/g; # hack round minify bug
- write_file( "$opt{docroot}/$path", $output );
+ write_file( "$opt{docroot}/$path", $opt{minify} ? CSS::Minifier::XS::minify($content) : $content );
}
elsif ( $path =~ /(.+)\.js$/ ) {
print "JS to : docroot:/$path\n";
mkdirp( ( $out_path =~ /^(.+)\/.+$/ )[0] );
## Write out the document
- open my $out, '>', $out_path or die $!;
+ open my $out, '>', $out_path or die "Unable to write $out_path - $!";
print $out $stylesheet->output_as_bytes($doc);
close $out;
}
error_help('Excess arguments') if ( scalar(@ARGV) );
error_help('Must include at least one of --web, --spec or --filter')
- unless ( defined $opt{web} || scalar( @{ $opt{spec} } ) || scalar( @{ $opt{web} } ) );
+ unless ( $opt{web} || scalar( @{ $opt{spec} || [] } ) || scalar( @{ $opt{filter} || [] } ) );
return %opt;
}