Sometimes, we want to add Bootstrap to an angular-cli project.
In this article we’ll look at how to add Bootstrap to an angular-cli project.
How to add Bootstrap to an angular-cli project?
To add Bootstrap to an angular-cli project, we can install the bootstrap
package and then add the Bootstrap script and CSS paths into angular.json.
We run
npm install bootstrap
to install bootstrap
.
Then we write
//...
{
"scripts": ["./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"],
//...
"styles": [
"styles.css",
"./node_modules/bootstrap/dist/css/bootstrap.min.css"
]
}
//...
to add the Bootstrap scripts and styles paths into angular.json.
Then we restart ng serve
so the changes in angular.json will be picked up.
Conclusion
To add Bootstrap to an angular-cli project, we can install the bootstrap
package and then add the Bootstrap script and CSS paths into angular.json.