Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you add Bootstrap to a Ionic App?

I am currently developing an Ionic app and I was wondering if I could add an image gallery based on Bootstrap. I know Ionic and Bootstrap don't work really well together, but I was wondering if it is possible.

like image 662
Vali Z. Avatar asked Feb 09 '16 08:02

Vali Z.


People also ask

How do I add bootstrap styles in Ionic 4?

With Ionic 4, this can be done easily by making use of the angular.json file open the angular.jsonfile, this can be located at the root of your project locate the the styles array, add the path to the downloaded bootstrap file

What is ng-bootstrap in ionic?

We have to use the ng-bootstrap library to demonstrate a few examples of using the bootstrap component in Ionic. Difference between bootstrap and ng-bootstrap ? Both bootstrap and ng-bootstrap are front-end frameworks created by Twitter. The ng-bootstrap is built specifically for an Angular. The official definition of ng-bootstrap

How do I install MDB jQuery in ionic?

If you're having an Ionic application created with jQuery in which you're having an initialized npm project, please install the MDB jQuery from npm / gitlab, and then import necessary mdb js / css files in index.html (or another main .html file in your application).

Can I host an Ionic 2 app as a stand-alone app?

However, this ionic forum answer ( Web version in ionic 2) from a moderator states that Ionic 2 apps cannot be hosted as stand-alone web apps yet, but that the functionality is “in the works”. Other problems I have heard about are resource issues, as serving an Ionic app would create a separate instance for every remote user.


2 Answers

Step 1:
Install bootstrap:

npm install bootstrap

Get bootstrap

Step 2:

Edit package.json:

"description": "An Ionic project",
......
"config": {
    "ionic_sass": "./sass.config.js"
}

Step 3:

Create new file sass.config.js in home folder

module.exports = {
includePaths: [
    "node_modules/ionic-angular/themes",
    "node_modules/ionicons/scss",
    "node_modules/ionic-angular/fonts",
    "node_modules/bootstrap/scss"
  ]
};

Step 4:

Edit variables.scss

@import "noto-sans";
......
@import "bootstrap";

Step 5:

Add your bootstrap code:

<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-success">Success</button>

Step 6:

Run ionic app

ionic serve

like image 151
Jayaprakash G Avatar answered Sep 22 '22 06:09

Jayaprakash G


According to this article Ionic + Twitter’s Bootstrap CSS Framework - Again!, it will be a lot of effort using bootstrap. However I found this slider for you How to Create Elegant Slider Carousel in Ionic Framework.

I hope it helps you! Good luck! ;)

like image 29
Emily Avatar answered Sep 24 '22 06:09

Emily