user9465677
user9465677

Reputation: 427

Laravel 5.7 cannot read css file

I need to use a custom css file but I am unable to call from the public/css directory. Is there anything else I need to do?

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

Upvotes: 1

Views: 714

Answers (3)

Saurabh Mistry
Saurabh Mistry

Reputation: 13669

give 777 permission to public folder and then try to access files

<link rel="stylesheet" href="/css/businessfrontpage.css"/>

Upvotes: 0

Neil
Neil

Reputation: 62

That should work for the file /public/css/businessfrontpage.css.

Since it doesn't seem to be working for you, here are a few things you can try/check.

  • Make sure /public/css/businessfrontpage.css actually exists at that specific path.
  • Make sure the name is spelled exactly right.
  • Try clearing your cache.

If you are using Laravel Mix:

  • Run npm dev (or whichever build task you use) and make sure Mix actually generates the right file and in the right path.
  • If you are using versioning/cache busting via mix.version() make sure to use the mix('path/to/file.css') helper instead of asset('path/to/file.css').

Upvotes: 0

kapitan
kapitan

Reputation: 2222

First, check whether it is loaded or not by opening the developer tools. Second, while developer tools is open, right-click the refresh icon and click on the "Empty cache and hard reload" option. Third, restart laravel server.

Upvotes: 2

Related Questions