- I want to use View JS in the main admin panel and frontend in a Laravel project.
- But the major problem is how to manage the master file of the admin panel and frontend
1 Answer
Just bundle them and output them separately within your mix config:
mix.js('resources/js/admin-panel.js', 'admin-panel.js')
.js('resources/js/frontend.js', 'frontend.js')
And reference the appropriate file in your layouts (which I'm assuming differ), for example:
//layouts/admin.blade.php
<script src="{{ asset('admin-panel.js') }}"></script>
and for your frontend
//layouts/frontend.blade.php
<script src="{{ asset('frontend.js') }}"><