5

How do you deal with mixing multiple .css and .js files into one which laravel mix used to do so far.

The new Laravel 9 comes with Vite.js installed and laravel mix removed. As the main function for which we mostly used laravel mix was to mix the files from the /resource folder into the /public folder (many files into one). How are you dealing with this or are you still using laravel mix along with Vite?

2
  • I import the .js files from ...../js/Composables into my <script setup> || youtube.com/watch?v=bBeO62ryQLY Commented Sep 17, 2022 at 15:23
  • Have you found any solution so far? Commented Jul 14, 2023 at 5:34

2 Answers 2

0

If you want to bundle multiple CSS/JS files into one file instead of producing separate outputs, you should concatenate the imports within a single file. Include resources/css/app.css and resources/js/app.js in your vite.config.js:

input: [
    'resources/css/app.css',
    'resources/js/app.js',
],

This will result in one CSS and one JS file being bundled.

New contributor
Duscir is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Sign up to request clarification or add additional context in comments.

Comments

-4

They replace mix with vite... everything else is same.
Tip..

Create fresh laravel 9 proj...
Install jetstream with inertia..All sets up resources/js , resources/components , app.js ... Vue3.

Just db migrate ,artisan serve , and npm run dev ....

1 Comment

I didn't ask about that : )

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.