-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.4] Allow multiple manifest files for mix helper #17759
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -552,38 +552,42 @@ function method_field($method) | |
/** | ||
* Get the path to a versioned Mix file. | ||
* | ||
* @param string $path | ||
* @param string $path | ||
* @param string $manifestDir | ||
* @return \Illuminate\Support\HtmlString | ||
* | ||
* @throws \Exception | ||
*/ | ||
function mix($path) | ||
function mix($path, $manifestDir = '') | ||
{ | ||
static $manifest; | ||
static $shouldHotReload; | ||
|
||
if (! $manifest) { | ||
if (! file_exists($manifestPath = public_path('mix-manifest.json'))) { | ||
if ( $manifestDir && ! starts_with($manifestDir, '/')) { | ||
$manifestDir = "/{$manifestDir}"; | ||
} | ||
|
||
if ( ! $manifest) { | ||
if ( ! file_exists($manifestPath = public_path($manifestDir . '/mix-manifest.json'))) { | ||
throw new Exception('The Mix manifest does not exist.'); | ||
} | ||
|
||
$manifest = json_decode(file_get_contents($manifestPath), true); | ||
} | ||
|
||
if (! starts_with($path, '/')) { | ||
if ( ! starts_with($path, '/')) { | ||
$path = "/{$path}"; | ||
} | ||
|
||
if (! array_key_exists($path, $manifest)) { | ||
if ( ! array_key_exists($path, $manifest)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please revert all these cs changes |
||
throw new Exception( | ||
"Unable to locate Mix file: {$path}. Please check your ". | ||
"Unable to locate Mix file: {$path}. Please check your " . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please revert all these cs changes |
||
'webpack.mix.js output paths and try again.' | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please revert all these cs changes |
||
} | ||
|
||
return $shouldHotReload = file_exists(public_path('hot')) | ||
? new HtmlString("http://localhost:8080{$manifest[$path]}") | ||
: new HtmlString($manifest[$path]); | ||
return file_exists(public_path($manifestDir . '/hot')) | ||
? new HtmlString("http://localhost:8080{$manifest[$path]}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert the indentation changes here. |
||
: new HtmlString($manifestDir . $manifest[$path]); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the changes to this line, and match the cs of the next line.