I am trying to integrate a custom html SaaS template in Laravel 7. I have put the template JS and CSS files in public directory and created a master blade in which I have link these js and css files. But somehow it is not working correctly. I do know that there is some issue with the app.js file but I am unable to identify the actual reason. I will appreciate if anyone can guide me in this regard.
CSS Files Path:
<head>
<meta charset="utf-8" />
<title>{{ config('site_name')}} | Dashboard</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- App favicon -->
<link rel="shortcut icon" href="{{url('images/favicon.ico')}}">
<!-- Bootstrap Css -->
<link href="{{ url('css/bootstrap.min.css')}}" id="bootstrap-style" rel="stylesheet" type="text/css" />
<!-- Icons Css -->
<link href="{{ url('css/icons.min.css')}}" rel="stylesheet" type="text/css" />
<!-- App Css-->
<link href="{{ url('css/app.min.css')}}" id="app-style" rel="stylesheet" type="text/css" />
@yield('theme_style')
</head>
JS Files Path:
<script src="{{url('libs/jquery/jquery.min.js')}}"></script>
<script src="{{url('libs/bootstrap/js/bootstrap.bundle.min.js')}}"></script>
<script src="{{url('libs/metismenu/metisMenu.min.js')}}"></script>
<script src="{{url('libs/simplebar/simplebar.min.js')}}"></script>
<script src="{{url('libs/node-waves/waves.min.js')}}"></script>
<!-- apexcharts -->
<script src="{{url('libs/apexcharts/apexcharts.min.js')}}"></script>
<script src="{{url('js/pages/dashboard.init.js')}}"></script>
<!-- App js -->
<script src="{{url('js/app.js')}}"></script>
@yield('theme_script')
The blade is loading but functionality related to some css and js is not working. All the files are linked correctly and loading in view page source.
Note: I also try 'npm run dev' to compile the files.
I found a solution to this question, actually I was using url() helper function for linking css/js path. I made two changes to my files:
1) I put all files in a folder as it was placed in a default html template.
2) I used URL::asset() OR asset() helper function to link my files.
After that i clear the cache and run the project. It just worked.
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.