0

I am very new to Laravel, I have done the login blade file and I included CSS files but it's not loading CSS files, can you please help me where I made a mistake ..?

users.blade.php

<link rel="stylesheet" href="{{ asset('resources/css/user.css') }}">
3
  • put your file on public directory => /public/resources/css/user.css Commented Jun 28, 2022 at 6:07
  • @sta, i tried this one too but it's not loading Commented Jun 28, 2022 at 6:10
  • where is your physical file location? Commented Jun 28, 2022 at 6:18

1 Answer 1

1

You're trying to access the resources folder, which is not exposed to the public, you'll have to compile your css so it lives in the public folder, which is the folder that anyone(including your frontend) can access using https://your-url.tld/{public file path}. There are 2 ways in which you can have your user.css file available for to your frontend:

One:

You can import your user.css file to the existing resources/css/app.css file:

/* app.css file */
@import "../path/to/user.css";

Two:

You can compile user.css to a separate file, in case you want to use that file specifically on another layout or blade file instead of mixing it globally with the app.css file:

// webpack.mix.js file
mix.js('...')
    .css('resources/css/user.css', 'public/css');

Then in your layout file:

// app.blade.php file
<link rel="stylesheet" href="{{ asset('css/user.css') }}">

Hope it helps.

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.