Bootstrap: Import Bootstrap in Angular 6 with ng add

Created on 4 May 2018  路  6Comments  路  Source: twbs/bootstrap

With the last version of Angular (6.0.0) there is a CLI to automatically add dependencies to an angular project. This makes it possible to import the NPM library and to modify the files of the project to use this library.
https://blog.angular.io/version-6-of-angular-now-available-cc56b0efa7a4#cff5

It could be great to have a shematic to just have to launch ng add bootstrap and the last version of bootstrap is added in the package.json, installed and the main style file import the bootstrap css or scss.

build feature js v4

Most helpful comment

There should be a @bootstrap/schematics for angular! To use ng add bootstrap or ng add @bootstrap/schematics to combine bootstrap and angular. It will improve integration experience by 200%.

All 6 comments

We don't use Angular within the project, so I can't see why we'd create this ourselves. Let me know if I'm misunderstanding and perhaps provide an example of what you're thinking.

@mdo it's to allow Angular user to install the last release of Bootstrap easely

I'm not against it, but I'll have to dig it a bit before adding that

There should be a @bootstrap/schematics for angular! To use ng add bootstrap or ng add @bootstrap/schematics to combine bootstrap and angular. It will improve integration experience by 200%.

I could take this task on me if there is enough interest and will to host it as part of the bootstrap organisation (background: I'm both Angular team member and maintainer of https://github.com/ng-bootstrap/ng-bootstrap).

IMO there should be 2 schematics:

  • add CSS only (for people using integration libs like https://github.com/ng-bootstrap/ng-bootstrap)
  • add CSS + JS and deps

Happy to devote time / maintain this in the longer run.
cc @Johann-S

Thinking this is stale and not someone on our radar for v4 or v5 @Johann-S?

yep currently out of time to do that and maintain that too, but @pkozlowski-opensource seems a better option to do that 馃憤

Was this page helpful?
0 / 5 - 0 ratings