Laravel Vite
Installation
-
Run the following commands to install NPM dependencies:
npm install
npm install vite -
Install SASS by running the following command:
Via NPMnpm i -D sass
Via Yarnyarn add --dev sass
Usage
-
Change this line of file /vite.config.js
Frominput: ['resources/css/app.css', 'resources/js/app.js'],
Toinput: ['resources/sass/app.scss', 'resources/js/app.js'],
-
Create the file:
/resources/sass/app.scss
-
In your main <head>, add the following line to include all static files automatically:
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
-
Use the following commands to generate the static files:
npm run dev
- needs to be running during the development, automatically refresh the page after any changes in any file.
npm run build
- compiles the final static files of the project, for production usage.