[5.8] Allow configuring a default manifest directory #27701
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR depends on laravel/laravel#4957.
This PR enables users to set a default manifest directory for all calls to the
mix
helper, so that they don't have to pass a second parameter to it every time. It also makes it less likely that a user will forget to pass the manifest directory to themix
helper. An additional benefit is that, if they would ever change this path, they can now change it in a single location, rather than having to go through all their views. It is also makes it easy to change this path in different environments.This PR doesn't break any existing features. It only adds one additional line to the
Mix
class and doesn't change its signature. The behaviour of the helper function stays the same if the configuration value isn't set.Example usage:
In webpack.mix.js
In
config/app.php
And then finally, in any view file:
Previously, you'd have to use the following every time you used a mix asset: