1

I am using laravel and nodejs on WAMP Server on Windows 10. Now using the elixir mix function

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

which is generating a version file for my app.css and placing it to

public\build\css\app-d37b3a9d94.css

now when I add the link of the css file by using elixir function, like following

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

it generates a path like

/build/css/app-d37b3a9d94.css

but with this, the css do not work on the resulted page. I troubleshoot the problem and found that it do not work due to the first slash in the path. when I manually add the above css file path (which elixir generated) by removing the first slash, it works. like the following

build/css/app-d37b3a9d94.css

I am not sure how to fix this problem where elixir generated path to css file work. Looks like elixir adding an extra slash before the path but I have checked the code on several places for laravel and the code works with first slash in path. Not sure why it is not working for me.

One more thing I have noticed, even if I remove mix.version('css/app.css'); from gulpfile.js (which generate version file) and run gulp command to update css/app.css, and use <link rel="stylesheet" type="text/css" href="{{ elixir('css/app.css') }}"> it still refer to the version file rather than referring to css/app.css Is it a correct behavior?

2

1 Answer 1

0

Try to use it this way:

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

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.