0
  • 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
  • Hi, what did you tried so far? Commented Jul 22, 2021 at 6:55

1 Answer 1

1

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') }}"><
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.