- Install popper js and bootstrap.
- Rename
resources/css to resources/scss and resources/css/app.css to resources/scss/app.scss.
@import "bootstrap/scss/bootstrap";
- Import all JavaScript plugins.
import * as bootstrap from 'bootstrap';
window.bootstrap = bootstrap;
- Replace code in vite.config.js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: ['resources/scss/app.scss', 'resources/js/app.js'],
refresh: true,
}),
],
});
- Build the assets.
- Use the assets.
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $title ?? 'Page Title' }}</title>
@vite(['resources/scss/app.scss', 'resources/js/app.js'])
</head>
<body>
{{ $slot }}
</body>
</html>