Flavors / Targets

Hello there,

I’ve been happily doing this client project with iOnic 2 right now, now what we already expected, they are asking about making a “white-label” out of this application.

Our client has many sub brands / clients and would like to implement these exact same features just with a different skin/styling.

That being said. Is there anything going such as Flavors and Targets when building native apps?
In short I’d switch around some configs, maybe some files (Like the file I use for translations etc.), these can be dependant on config variables for all I care. And of course some images, style, icons and splash screens.

Is there such a system already? Any thoughs?

3 Likes

+1 for this question. I am facing a similar issue, but what I need is the ability to change the config.xml as well as the ressources folder on build time.
It would be really great if anybody had the same issue, solved it and could elaborate on a solution.
Thanks in advance :slight_smile:

1 Like

+1 for this question.

I am evaluating ionic for building an app for our multi-tenant service. We will like to publish a separate app for each of our clients. I can easily create tenant specific favor for native android app using gradle’s flavors feature. I an not able figure out how to do this for ionic apps.

Can anyone suggest a solution?

Vikram

As far as I can see, it’s not really that easy to make true flavours, but it would be possible to use different webpack configs for building which will build different scss files. (for styling only but also you could do something manually with loading certain files in certain webpack configs.

This is however quite a difficult process to set up but could work. You could load in certain folders based on different flavors when building your application.

I’m not going to provide an example because it’s not trivial.

Thanks for your reply.

For the flavours are critical, not so much for different styling, but more for the ability to put them in play store as different apps - one for each of our tenants. These will be “their” apps, that will talk to only their account in our multi-tenant application.

I guess I need to explore more.

Well in that case you’re mostly talking about ability to change namespaces and such. You only need to edit one file for doing so (which is the cordova config.xml file). It would however be tedious to keep doing so, but a simple git branching technique will suffice if it’s only that file that gets changes.

Allthough I’m quite sure there will be tools which allow what you’re asking for. Ionic itself is a framework which runs inside an cordova app (and generates the needed cordova files), so if you are going to work with cordova anyway, iOnic should be fine. imo.

After 1 year, do we have a solution?

I ended up posting a similar question here and in StackOverflow.

If you tier some solution even if unofficial I believe it will help many.

After some analysis I see that a good part (package name, application id, application name, etc.) of this problem can be solved with the possibility of creating config.xml, for flavors, that could be selected via parameters of build, run, etc, example: $ ionic run android --flavors=free, and config.xml could merge with base config.xml.

3 Likes

This guy’s post.
looks like the beginnings of such a system. I’m interested in trying it out.

There’s also some good discussion on this stackoverflow post about how to customize app names if you need more than just an icon changed.

Also check out: my initial stab at it