When laravel app is in subfolder of domain and assets are versioned via elixir's .version() worker then elixir helper doesn't respect subfolder. It just returns plain /build/ path:
https://github.com/laravel/framework/blob/5.1/src/Illuminate/Foundation/helpers.php#L691
Unfortunately this was already brought up here https://github.com/laravel/framework/issues/8565 and the response was basically that you shouldn't install Laravel in a subdirectory. Sometimes that's not always an option, e.g. my company doesn't want to generate a new subdomain for our staging server for each new app we make, so I'm forced to not use version()
in any of my projects.
I also think elixir()
should generate a path relative to the app root for consistency with Laravel's other helpers e.g. asset()
, but it's not my decision.
FYI it was changed for Laravel 5.2 to use the asset()
helper: #9552
(This can't be changed for 5.1 since it's a breaking change)
For a workaround until then, just add your own elixir()
helper function that uses asset()
I have just made a workaround - nest the elixir helper into asset in Blade this way:
{{ asset(elixir('css/style.css')) }}
It works for me
Most helpful comment
I have just made a workaround - nest the elixir helper into asset in Blade this way:
{{ asset(elixir('css/style.css')) }}
It works for me