- Generate new project choosing
scss
as default
> ng g angular-bootstrap
- Install bootstrap as a node dependency
> npm i bootstrap@latest
- Go to the
node_modules/bootstrap/scss/bootstrap.scss
file and copy all the content inside - Go to
src/styles.scss
and paste - Prepend every
@import
string with~bootstrap/scss/
i.e.
// before
@import "functions";
...
// after
@import "~bootstrap/scss/functions";
...
- Run
ng serve
for a dev server. Navigate tohttp://localhost:4200/
.
- Open
angular.json
file - Append
"stylePreprocessorOptions"
after"architect" > "build" > "options" > "styles"
"styles": [
"src/styles.scss"
],
"stylePreprocessorOptions": {
"includePaths": [
"node_modules/bootstrap/scss"
]
},
- Stop the server
[Ctrl]+[C]
then run againng serve
to apply changes. Navigate tohttp://localhost:4200/
.
To override Bootstrap settings (variables) put code before Bootstrap's @import
statements - examples provided in styles.scss
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
This project was generated with Angular CLI version 7.0.5.