0

i have installed Laravel 5.4 in localhost. I'm using XAMPP to host the application. I'm using Laravel's inbuilt Blade template structure to show the data. I have used asset() helper to load my assets files which is inside the public folder. A sample code is here.

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

But CSS file is not loading. I discovered this from Chrome developer tool's Network section. I have worked with Laravel before with it's other version and this is the first time that i'm working with version 5.4. Hope someone will assist me to solve this.

2
  • Install 5.5 already. Commented Sep 22, 2017 at 9:38
  • put css in public or storage Commented Sep 22, 2017 at 9:39

1 Answer 1

1

you can use only asset function like this i hope you have css folder inside public folder as mentioned in the path.

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

asset()

Generate a URL for an asset using the current scheme of the request (HTTP or HTTPS):

Ref: https://laravel.com/docs/5.4/helpers

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

10 Comments

I used this method as well before. So i decided to try with mentioned way.
Nope it's also not working. But by using these both methods, i can see it generates correct url when i'm checking the Network section of the browser.
i think you dont have file inside public folder and mentioned path
It's inside public folder->assets folder and then my mentioned folders
if its asset folder then update like asset('asset/backend/vendors/bootstrap/dist/css/bootstrap.min.css')}}
|

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.