简体   繁体   中英

Including external css and JS files in Laravel 5

I have made a programme using JavaScript and some styling using CSS I wish now to add a login system to make it more secure. I have made the login system using Laravel 5. The issue I am having is when I import the files. I am getting this error:

http://127.0.0.1:8000/js/jquery-3.5.1.min.js net::ERR_ABORTED 404 (Not Found)

for all of my JavaScript and CSS files. All of my JS and CSS files are in the views folder is this the correct place for them to be? or do I need to do something else?

Also, I have tried to use these:

<link rel="stylesheet" href="{{ asset('stylesheet.css') }}" />
<link rel="stylesheet" href="{{ URL::asset('stylesheet.css') }}" />
<link rel="stylesheet" href="{{ URL::to('stylesheet.css') }}" />
<link rel="stylesheet" href="{{ url('stylesheet.css') }}" />

They didn't work. I am guessing that the issue is a routing issue? Can someone help me to fix this?

All assets must be in public folder where your app root directory. https://laravel.com/docs/7.x/structure#the-public-directory

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM