Skip to content

Commit

Permalink
Multiple Assetic route configurations can be matched by a single route.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roel van Duijnhoven committed Jun 10, 2013
1 parent 2226e14 commit 3a223cc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/AsseticBundle/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,23 @@ public function getRoutes()

public function getRoute($name, $default = null)
{
// gives possibility to specify regex in route name
$assets = array();
$routeMatched = false;

// return all routes for which the route name matches the regex
foreach ($this->routes as $spec => $config) {
if (preg_match('(^' . $spec . '$)i', $name)) {
return $config;
$routeMatched = true;
$assets = Stdlib\ArrayUtils::merge($assets, (array) $config);
}
}

if ($routeMatched) {
return $assets;
} else {
return $default;
}

return $default;
}

Expand Down

0 comments on commit 3a223cc

Please sign in to comment.