DEV Community

Cover image for Adding bootstrap to an exisiting Angular Project using angular-cli
Deen Muaz
Deen Muaz

Posted on

Adding bootstrap to an exisiting Angular Project using angular-cli

Hello there,

I assume you are running an angular project and want to find out how to install bootstrap and add it to your project.

If so then, lets get right onto it.

1. Step 1 - installing Angular cli

First, we'll start by installing the angular-cli if it hasn't been done already by typing in the following command :

npm install -g @angular/cli

this will install angular-cli globally on your system

2. Step 2 - Starting a new angular project

Start a new angular project by typing:
ng new <ProjectName>

3. Step 3 - Installing bootstrap

In your projects root directory, install bootstrap by typing in :

npm install bootstrap

you can add the version number at the end i.e npm install bootstrap@5.0, however not adding it installs the latest version to your project

4. Importing bootstrap into our project

For the final step, we will need to import bootstrap to our project by adding an import statement in our root folders styles.css files

Open the src/styles.css file of your Angular project and import the bootstrap.css file as follows:

@import "~bootstrap/dist/css/bootstrap.css"

Top comments (0)