In this Laravel 12 tutorial, you’ll learn how to install Bootstrap 5 in laravel 12 with Vite and set it up properly for your application. Bootstrap 5 is one of the most popular front-end frameworks for building responsive and beautiful web applications. Laravel 12, the latest version of the Laravel framework, comes with Vite as its default build tool, making it incredibly easy to integrate Bootstrap into your application.
In this comprehensive guide, we’ll walk through the step-by-step process of installing and configuring Bootstrap 5 in Laravel 12 using Vite. This tutorial is designed for beginners and includes practical examples and troubleshooting tips.
Table of Contents
- What is Vite and Why Use It?
- Step 1: Install Laravel 12 Project
- Step 2: Install Bootstrap 5 and Dependencies
- Step 3: Install Bootstrap 5.3
- Step 4: Build CSS and JS Files
- Step 5: Use Bootstrap Classes
- Step 6: Run Laravel App
- Conclusion
What is Vite and Why Use It?
Vite is a modern build tool that provides an extremely fast development experience. In Laravel, Vite handles the compilation of your SCSS and JavaScript files into optimized CSS and JS assets.
Benefits of using Vite with Bootstrap:
- Hot Module Replacement (HMR): See changes in your browser instantly without manual refresh
- Lightning-fast builds: Optimized asset compilation
- Minification: Automatic optimization for production
- SCSS support: Seamlessly compile SCSS to CSS
- Easy configuration: Minimal setup required
Step 1: Install Laravel 12 Project
If you don’t already have a Laravel 12 project, create one using the Laravel installer:
composer create-project laravel/laravel bootstrap-vite
Step 2: Install Bootstrap 5 and Dependencies
Next, install the Laravel UI package. The composer require laravel/ui command installs the Laravel UI package, which offers ready-made frontend scaffolding for frameworks like Bootstrap, Vue, and React. It’s mainly used to quickly generate authentication routes and views in a Laravel project.
composer require laravel/ui
This command downloads and installs the laravel/ui package and its dependencies into your Laravel project, allowing you to access its features. Generating UI Scaffolding.
Step 3: Install Bootstrap 5.3
After installing the laravel/ui package, you can use Artisan commands to generate the desired frontend scaffolding:
Read Full tutorial : How to Install Bootstrap 5 in Laravel 12 with Vite

Top comments (0)