Today I will list steps needed to download Bootstrap 5 using npm.
1- Install Bootstrap
.
npm install bootstrap
2- Use Bootstrap
:
You have 2 options to import Bootstrap's JS.
Option 1:
import all of Bootstrap’s plugins so you will not need @popperjs/core
package
import '../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js';
Option 2:
Import just plugins you need. Then you will need to install and import @popperjs/core
package before import bootstrap plugins
a- Install @popperjs/core
package.
npm i @popperjs/core
b- In your app.js file import bootstrap and @popperjs/core.
import '../../node_modules/@popperjs/core/dist/umd/popper.min.js';
import 'bootstrap/js/dist/dropdown';
c- Import Bootstrap's CSS.
@import "bootstrap/scss/bootstrap";
Top comments (0)