Permalink
Browse files

added handling of multiple roots

  • Loading branch information...
1 parent 059a353 commit f33f1a96aadafec8240ad820cc8f1dd2820b1ac7 @tjczepiel tjczepiel committed May 19, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/Plack/Middleware/CombineStatic.pm
@@ -66,11 +66,20 @@ sub call {
else {
my @files = split /,/, ( $request->param( $self->parameter ) || '' );
- my @paths = map { join '/', $self->root, $_ } @files;
return unless @files;
return if grep { $_ !~ /$self->path/ } @files;
+ my $root =
+ ref $self->root eq 'ARRAY' ? $self->root : [ $self->root ];
+
+ my @paths;
+ for my $file ( @files ) {
+ push @paths, map { join '/', $_, $file } @$root;
+ }
+
+ my @paths = grep { $_ if -e } @paths;
+
( $content_type, $content ) = $self->_slurp(@paths);
$content = $self->_minify( $content_type, $content );
@@ -136,7 +145,6 @@ sub _minify {
return $content unless $self->minify();
- warn "content type $content_type";
my $type = $content_type =~ /javascript/ ? 'javascript' : 'css';
Class::Load::load_class( $minifiers{$type} );

0 comments on commit f33f1a9

Please sign in to comment.