I am using laravel 5.8. And I got a huge problem. CSS and Bootstrap cannot be read.
1.I did rm storage because I wanted to make php artisan storage:link work. Finally I couldn't.
2.After php artisan serve did not work, so I changed to chdir('/'); in ServeCommand.php.
3.Also I changed to
$this->app->bind('path.public', function() {
return base_path('PATH TO PUBLIC FOLDER');
});
in AppServiceProvider.php
4.Now php artisan serve is working but CSS and BootStrap cannot be loaded.
This is my index.blade.php (landing page, all links are pasted in this file)
<link href="https://fonts.googleapis.com/css?family=Amatic+SC:400,700|Work+Sans:300,400,700" rel="stylesheet">
<link rel="stylesheet" href="{{asset('external/fonts/icomoon/style.css')}}">
<link rel="stylesheet" href="{{asset('external/css/bootstrap.min.css')}}">
<link rel="stylesheet" href="{{asset('external/css/magnific-popup.css')}}">
<link rel="stylesheet" href="{{asset('external/css/jquery-ui.css')}}">
<link rel="stylesheet" href="{{asset('external/css/owl.carousel.min.css')}}">
<link rel="stylesheet" href="{{asset('external/css/owl.theme.default.min.css')}}">
<link rel="stylesheet" href="{{asset('external/css/bootstrap-datepicker.css')}}">
<link rel="stylesheet" href="{{asset('external/css/animate.css')}}">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mediaelement@4.2.7/build/mediaelementplayer.min.css">
<link rel="stylesheet" href="external/fonts/flaticon/font/flaticon.css">
<link rel="stylesheet" href="{{asset('external/css/aos.css')}}">
<link rel="stylesheet" href="{{asset('external/css/style.css')}}">
I created external folder in public folder.
If someone knows solution, please help me out.
Thank you.
While I don't know what you exactly want to achieve, I am asuming you want to load files from the public/external
directory.
If you have a clean Laravel 5.8 install {{asset('external/css/bootstrap.min.css')
should work out of the box. So I should delete the app->bind
stuff and try to use
{{asset('external/css/bootstrap.min.css')
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.