Skip to content

Commit

Permalink
Item2607: Support both JavaScript::Minifier and JavaScript::Minifier:…
Browse files Browse the repository at this point in the history
…:XS APIs

Item2139: Add anonymous subroutine and common API to minifier()

git-svn-id: http://svn.foswiki.org/trunk@5976 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
DrakeDiedrich authored and DrakeDiedrich committed Jan 8, 2010
1 parent 043554e commit add6b06
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions BuildContrib/lib/Foswiki/Contrib/Build.pm
Expand Up @@ -1078,7 +1078,7 @@ sub build_js {
$minifier = \&JavaScript::Minifier::XS::minify;
}
elsif ( eval { require JavaScript::Minifier } ) {
$minifier = \&JavaScript::Minifier::minify;
$minifier = sub { JavaScript::Minifier::minify(input => $_[0]) };
}
else {
print STDERR "Cannot squish $to: $@\n";
Expand All @@ -1092,7 +1092,7 @@ sub build_js {
my $text = <IF>;
close(IF);

$text = &{$minifier}( input => $text );
$text = &{$minifier}( $text );

unless ( $this->{-n} ) {
if ( open( IF, '<', $to ) ) {
Expand Down Expand Up @@ -1132,7 +1132,7 @@ sub build_css {
$minifier = \&CSS::Minifier::XS::minify;
}
elsif ( eval { require CSS::Minifier } ) {
$minifier = \&CSS::Minifier::minify;
$minifier = sub { CSS::Minifier::minify(input => $_[0]) };
}
else {
print STDERR "Cannot squish $to: $@\n";
Expand All @@ -1146,7 +1146,7 @@ sub build_css {
my $text = <IF>;
close(IF);

$text = &{$minifier}( input => $text );
$text = &{$minifier}( $text );

unless ( $this->{-n} ) {
if ( open( IF, '<', $to ) ) {
Expand Down

0 comments on commit add6b06

Please sign in to comment.