[5.4] Don't wrap asset path in default domain #17727
Merged
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 is made in reference to laravel/ideas#392. In essence this brings the
mix
helper function into line with the oldelixir
helper function by just returning a relative path to the compiled asset, rather than an absolute path. This is helpful when the assets are served from another domain, such as a CDN.In order to do it as-is you would need to strip the default domain from the return value of the function and replace it with the alternate domain, which doesn't feel like all that great of a solution. Either way, by default I think it makes more sense to return a relative path rather than an absolute one.
One alternative would be to add another configuration variable, perhaps an
asset_url
that would be used when generating asset links - it could fallback to the default domain when it isn't set.I'm not entirely sure if this is a breaking change or not... I can't see why it would be necessarily as it's always going to return an absolute URL with the default domain, and now it's just going to be a relative URL on that same domain.