If you're looking to integrate Bootstrap into your Angular (7+) project, follow these steps:
Begin by installing the latest version of Bootstrap using the command below.
npm install bootstrap --save
Once installed, a Bootstrap folder will be generated in the node_modules directory. You'll then need to configure Bootstrap CSS in the angular.json file.
"projects": {
"ng-base": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/ng-base",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.scss"
],
"scripts": []
},
Alternatively, you can import Bootstrap from your style.scss file like so:
@import "~bootstrap/dist/css/bootstrap.min.css";
After completing these steps, simply restart the application using the ng serve command. You should now see both your custom styles and Bootstrap's styles reflected in the dev tools.