Home > Net >  Including Bootstrap-like styles with first Angular and LESS app
Including Bootstrap-like styles with first Angular and LESS app

Time:02-01

I know Bootstrap and some other frameworks related to Angular a bit but am going into first Angular 13 app.

I can see that using LESS is an option which is cool for all the variables and mix-ins and such, but how go I get bootstrap indirectly into my Angular app?

I want it to use on LESS but still having the ability to use things from Bootstrap like spacing and breakpoints and toolitps part of BS 5.1 :

pe-3, mb-2, etc.
  1. Does Bootstrap still using JQuery? (I don't think so but want to be sure)
  2. Can we use Bootstrap in this way and keep things precompiled and fast for downloading the single page application?

Again I am new to Angular and incorporating everything.

CodePudding user response:

Yes, You can use bootstrap in the angular application along with your custom LESS code. The easiest way would be to add the CDN links on the bootstrap website to the header section in the index.html file in your angular application.

CodePudding user response:

If you want to use Angular and Bootstrap together I'd recommend making things easier on yourself.

  1. Don't use LESS, use SASS -- both Angular and Bootstrap use SASS out of the box, which still gives you variables and other CSS-pre-processor features.
  2. Don't mess around with imports yourself, just use ng-bootstrap

Not only will ng-bootstrap get you all the classes you're familiar with, it also makes a number of more complex components relatively easy.

Note: if you want Bootstrap 5 you'll need @ng-bootstrap/ng-bootstrap@bootstrap5

  •  Tags:  
  • Related