Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add and use bootstrap to an ionic 4 app?

I am building an ionic 4 application, and I want to use bootstrap without using the CDN method. I have installed bootstrap with npm install bootstrap.

like image 377
tnyamuz Avatar asked Dec 18 '22 20:12

tnyamuz


1 Answers

With Ionic 4, this can be done easily by making use of the angular.json file

open the angular.json file, this can be located at the root of your project

locate the the styles array, add the path to the downloaded bootstrap file

"styles": [
          {
            "input": "src/theme/variables.scss"
          },
          {
            "input": "src/global.scss"
          },
          {
            "input": "node_modules/bootstrap/dist/css/bootstrap.min.css"
          }
        ],

if you wish to make use of bootstrap scripts, add the bootstrap script to the scripts array as well.

Please note: for you to make use of bootstrap scripts, jquery and popper.js are required to be added to your projects as well

like image 64
Triple0t Avatar answered Mar 06 '23 10:03

Triple0t