Sunday, August 5, 2018

How to add bootstrap to your angular project?


How to install bootstrap?



  • Use one of the commands below depending upon the package manager you are using.
npm install bootstrap
gem install bootstrap -v 4.1.3

check file size before adding bootstrap, when you run ng serve command, in command prompt you will see the file size.

  • Add an entry in app.component.css
@import "~bootstrap/dist/css/bootstrap.css";

  • Create a button in the app.component.html with following class property.

class='btn btn-primary'

prior adding bootstrap it will be around 15kb, however, after adding bootstrap it will increase

Below is the extract from terminal which shows increased size.
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 227 kB [initial] [rendered]


No comments:

Post a Comment

Calculating Server Capacity: A Comprehensive Tutorial

 In this tutorial we will explore the process of calculating server capacity. Let's get started. Understanding Server Capacity Identifyi...