Skip to content

Commit

Permalink
Fix cache in mix method. (#19968)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieutu authored and taylorotwell committed Jul 9, 2017
1 parent 1a5fce3 commit 9486661
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,32 +537,30 @@ function mix($path, $manifestDirectory = '')
$manifestDirectory = "/{$manifestDirectory}";
}

$manifestKey = $manifestDirectory ? $manifestDirectory : '/';

if (file_exists(public_path($manifestDirectory.'/hot'))) {
return new HtmlString("//localhost:8080{$path}");
}

if (in_array($manifestKey, $manifests)) {
$manifest = $manifests[$manifestKey];
} else {
if (! file_exists($manifestPath = public_path($manifestDirectory.'/mix-manifest.json'))) {
$manifestPath = public_path($manifestDirectory.'/mix-manifest.json');

if (! isset($manifests[$manifestPath])) {
if (! file_exists($manifestPath)) {
throw new Exception('The Mix manifest does not exist.');
}

$manifests[$manifestKey] = $manifest = json_decode(
file_get_contents($manifestPath), true
);
$manifests[$manifestPath] = json_decode(file_get_contents($manifestPath), true);
}

if (! array_key_exists($path, $manifest)) {
$manifest = $manifests[$manifestPath];

if (! isset($manifest[$path])) {
throw new Exception(
"Unable to locate Mix file: {$path}. Please check your ".
'webpack.mix.js output paths and try again.'
);
}

return new HtmlString($manifestDirectory.$manifest[$path]);
return new HtmlString(asset($manifestDirectory.$manifest[$path]));
}
}

Expand Down

0 comments on commit 9486661

Please sign in to comment.