0

So I have a view that the css and js is not loading:

The controller:

 return view('home.news')
                ->with("news", $news);

the route:

Route::get('/news/{id}', ['as'=>'home.news','uses'=>'HomeController@news']);

And I have used asset to get the data from css and js

css:

<link rel='icon' sizes="16x16" href="icon/favicon-icon.png" type='image/x-icon'>
<link rel="stylesheet" href="{{asset('node_modules/bulma/css/bulma.min.css')}}" type="text/css">
<link rel="stylesheet" href="{{asset('node_modules/swiper/css/swiper.min.css')}}">
<link rel="stylesheet" href="{{asset('node_modules/@fortawesome/fontawesome-free/css/all.min.css')}}">
<link rel="stylesheet" href="{{asset('styles/packages.css')}}" type=" text/css">
<link rel="stylesheet" href="{{asset('styles/general.css')}}" type=" text/css">
<link rel="stylesheet" href="{{asset('styles/jquery-ui.css')}}" type=" text/css">
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
@yield("css")

js:

<script src="{{asset('node_modules/swiper/js/swiper.min.js')}}"></script>
<script src="{{asset('js/swipers.js')}}"></script>
<script src="{{asset('js/navbar.js')}}"></script>
<script src="{{asset('js/jquery.js')}}"></script>
<script src="{{asset('js/jquery-ui.js')}}"></script>
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>

<script type="text/javascript">
  AOS.init();
</script>

Any help would be appreciated, Thank you!

OMR
  • 11,736
  • 5
  • 20
  • 35
marcsabeh
  • 39
  • 2
  • 7

1 Answers1

1

probably it's because wrong path for your files. your css and js folders should be inside the public folder of your laravel project. if it's not working yet you can replace "asset" with "url".

Amir Khaledian
  • 109
  • 1
  • 4