I'm using blade with Vite for front-end and I want Vite to handle and version all of my .scss,.js, and static assets files
this is from the documentation :
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel([
'resources/css/app.css',
'resources/js/app.js',
]),
],
});
I need to specify the entry points for my application so what if I have a 300 js file for example
should I import all of them inside the app.js file? but then the output file will be huge and most of the scripts will not be used on a single page
I think I'm missing something here can anyone help me figure out how to use Vite correctly?
for example, I want Vite to compile home.scss file to a file called home.css and if I use
@vite('resources/scss/home.scss')
file inside home.blade.php
file it should link to the home.css?v=1697700661
I don't want to make all of my scripts and CSS in a single app.js or app.css file because this will affect the website's performance and might cause conflicts in the JS querySelector
I solved it by specifying each file that I want to use separately, I don't think it's the best way but it worked :