Skip to content

Commit

Permalink
make buildDir for Cdn::elixir customizable Vinelab#107
Browse files Browse the repository at this point in the history
  • Loading branch information
maximkou committed Jan 18, 2017
1 parent b57823a commit b7274b1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Vinelab/Cdn/CdnFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,20 @@ public function asset($path)
* it's CDN url.
*
* @param $path
* @param string $buildDir
*
* @return mixed
*
* @throws Exceptions\EmptyPathException, \InvalidArgumentException
*/
public function elixir($path)
public function elixir($path, $buildDir = 'build')
{
static $manifest = null;
if (is_null($manifest)) {
$manifest = json_decode(file_get_contents(public_path('build/rev-manifest.json')), true);
$manifest = json_decode(file_get_contents(public_path("$buildDir/rev-manifest.json")), true);
}
if (isset($manifest[$path])) {
return $this->generateUrl('build/' . $manifest[$path], 'public/');
return $this->generateUrl($buildDir . '/' . $manifest[$path], 'public/');
}
throw new \InvalidArgumentException("File {$path} not defined in asset manifest.");
}
Expand Down

0 comments on commit b7274b1

Please sign in to comment.