0

Why is Laravel searching for my CSS file in the wrong directory? I've seen this question posted a few times but it's never actually been answered with Elixir. I am assuming there are possibly some configurations that need to be done which aren't covered in the documentation (at least from what I can tell).

My layout.blade.php file links to the css stylesheet as follows:

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

My CSS file is loaded in the following path:

localhost/fresh/public/build/css/app-279b78681b.css

However,it is looking for the file here (it is notably missing /Fresh/public/ which I can't determine why?):

localhost/build/css/app-279b78681b.css

I am running an Apache 2.4 webserver for my laravel 5.2 project (not on homestead and not on a VM) and my gulpfile.js file has the following code:

elixir(function(mix) {
    mix.sass('app.scss')
       .version('/css/app.css');
});

All of that being said, if I were to change my layout.blade.php file to the following:

<link rel="stylesheet" href='css/app.css'>

It will capture my stylesheet that is located in the following directory correctly:

localhost/fresh/public/css/app.css

Sooooo, why can't it capture the css stylesheet when i use Elixir and why is it linking the wrong location?

1 Answer 1

0

I have the same problem too.

I used as workaround:

<link rel="stylesheet" href="{{ url(elixir('css/app.css') }}">

or

<link rel="stylesheet" href="{{ asset(elixir('css/app.css')) }}">

It's just that it outputs absolute path then in the generated file. It works but I don't like it so am also still interested how to fix it properly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.