asset() vs mix() and relative vs absolute URLs #33969
Unanswered
ethanclevenger91
asked this question in
General
Replies: 2 comments
-
mix_url is used by Laravel Vapor. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Since this seems to be more of a feature request than a true "bug", will convert this to a discussion for now. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
The
mix()
helper produces a relative URL unless you've definedmix_url
inconfig/app.php
. Or that's the implication of this line.Out of the box, however,
asset()
produces an absolute URL based on the app's configured URL.And in
config/app.php
, we actually have anasset_url
value out of the box for parity withmix_url
-asset()
just doesn't rely on it.This can result in some edge cases like this one where you end up doing
asset(mix())
to get the absolute URL you want.Seems like the behavior should be consistent.
asset
should either depend on the config file, ormix
shouldn't, and having a consistent configuration from one to the other should result in a consistent URL treatment.Also could be worth considering dropping the
mix_url
config entirely (I think it's undocumented?) and using the same config value to generate both, but that may have side-effects.Steps To Reproduce:
{{ asset('css/app.css') }}
.{{ mix('css/app.css') }}
{{ asset(mix('css/app.css')) }}
Beta Was this translation helpful? Give feedback.
All reactions