Download Bootstrap 5 using npm

sarah27h

Sarah Hassan

Posted on October 17, 2021

Download Bootstrap 5 using npm

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';
Enter fullscreen mode Exit fullscreen mode

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';
Enter fullscreen mode Exit fullscreen mode

c- Import Bootstrap's CSS.

@import "bootstrap/scss/bootstrap";

đź’– đź’Ş đź™… đźš©
sarah27h
Sarah Hassan

Posted on October 17, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Download Bootstrap 5 using npm
bootstrap Download Bootstrap 5 using npm

October 17, 2021