How to import bootstrap into vite projects?

Member

by mac , in category: Javascript , a month ago

How to import bootstrap into vite projects?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by arnoldo.moen , a month ago

@mac 

To import Bootstrap into your Vite project, you can follow these steps:

  1. Install Bootstrap and its peer dependencies:
1
npm install bootstrap@latest


  1. Import the Bootstrap CSS file in your main.js or App.vue file:
1
import 'bootstrap/dist/css/bootstrap.min.css';


  1. You can also import Bootstrap JavaScript files if needed:
1
import 'bootstrap/dist/js/bootstrap.min.js';


  1. Restart your Vite development server to apply the changes.


That's it! You have now successfully imported Bootstrap into your Vite project. You can start using Bootstrap classes and components in your project.