Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Elixir paths

I use Elixir to compile my less files

elixir(function(mix) {
mix.less([
    "../../../vendor/uikit/uikit/src/less/uikit.less",
    "main.less"
], 'public/css/style.css').version("public/css/style.css");
});

then I try to use css file like

<link rel="stylesheet" type="text/css" href="{{ elixir('css/style.css') }}">

but I result I get http://localhost:8080/build/css/style-a3ade8736f.css 404 (Not Found)

I use XAMMP so my url looks like http://localhost:8080/ad/public/

When I try to add 'piblic/' word in css href like
<link rel="stylesheet" type="text/css" href="public/{{ elixir('css/style.css') }}">
I get an error to like
http://localhost:8080/ad/public/public//build/css/style-a3ade8736f.css 404 (Not Found)

How to fix href?

like image 691
Heidel Avatar asked Jul 03 '26 22:07

Heidel


1 Answers

You can call Elixir function inside asset() or url().

Like this:

{{ asset(elixir('css/style.css')) }}

Or

{{ url(elixir('css/style.css')) }}

This thread solves the issue.

like image 180
Jeroen Bellemans Avatar answered Jul 06 '26 12:07

Jeroen Bellemans



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!