How to use bower with ionic2

Hey everyone,

I’m trying to get my hands on ionc2 and I was wondering what the best practise is to use bower with ionic2? How do I structure the project folders properly to use bower_components?

is

www/build/bower_components

the right place?

I wouldn’t install bower components there because then you will be compiling that whole directory with your APK/IPA

Install your components in your project root directory and then import only the files you need in your SASS/TS/JS files. Then web-pack will automatically add your code you the app.bundle.js

1 Like

thx @ihadeed I’ll give it a try.

I’m trying to use a ionic 1 module (will try using UpgradeAdapter) but I’m no sure how to do that.
What about .css files?

So what are the procedures of doing so? can you give us an example?

What I do is I install what I need via npm, or just download it in any other way. Then I save the files I need inside the app folder just to keep things organized.

- JS / TS files:
I import them from my app’s TypeScript files.
I saw an alternative solution in this post here but I haven’t tested it: Modular charts in Ionic?

// Importing TypeScript module
import {Camera} from 'ionic-native';

// Importing JavaScript library
import * as Chart from 'pathToJSOrNPMPackage'; // Import a JS file that has 

- CSS / SCSS files:
I import them from my app’s SCSS files

@import "path/to/css/or/scss/file";
2 Likes