How to import bootstrap into vite projects?

Member

by mac , in category: Javascript , a year ago

How to import bootstrap into vite projects?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by arnoldo.moen , a year 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.

Related Threads:

how to import bootstrap in react js?
How to import javascript file in vite?
How to import assets in v-html with vite?
How to import libraries as plugins in a vite application?
How to import types from npm package using vite?
How to update vite 3 project to vite 4?