vikram
vikram

Reputation: 371

Css and Js files in my New Laravel Project are not loading

I was given a Laravel project and I manage to download it's configuration and get it started on php artisan serve.

When I open it on localhost:8000 It opens but only the html portion of it.

It seems like css files didn't load for it.

Is there some sort of package we need to install with composer in my environment.

To get the css working.

The public folder looks like this in the laravel project.

    backend  favicon.ico  front  images  index.html  index.php  js  robots.txt  sql  vendor  
    web.config

Upvotes: 2

Views: 6216

Answers (1)

STA
STA

Reputation: 34688

Laravel provides a helper function, asset(), which generates a URL for your assets. You can use this in blade syntax.

Put your css, js files on public folder. for example of a css file, put it on :

../public/bootstrap/css/bootstrap.min.css

In your blade you can access this file from header like this :

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

hope this help

Upvotes: 2

Related Questions