Hello,
I’m building an app that will be branded differently per customer.
I mean that same application will be available in stores under different names, using different CSS themes and also different configuration for data services.
I would like to avoid copy/pasting code between app instances, how would you approach it knowing that I may have 10 customers?
I have thought about creating a cordova plugin with all common angularjs code and views but I have no experience here.
Thanks
You have 2 requirements here:
- Managing a common code base across applications
- Branding and distribution
So to lay the ground work what I would do is create a base project, which includes all of your cordova plugins, config and assets which will be required by all your customers.
The angularJS application should be a module that you can put in a lib
folder outside of www
and manage it as a gitsubmodule, this will allow you to update your codebase across all your customers without having to copy paste code.
Then all you need to do is create a config file which is specific to that customer - assets, labels, translations etc that your lib application looks for and uses to pull in the customer config.
You could make this as part of your gulp tasks when building the application.
Managing your resources and ionic.project
and app id will be restricted to a single project. But if you follow the structure above you can clone the project for as many customers as you require, maintain a single code base and write additional code if required without it affecting your common library application.
1 Like
Thanks a lot for this detailed answer, I know how to start now.
I haven’t yet used git submodules but it seems a good solution
At first I thought to have only one git repo for all customers and copying the common module into customer projects using gulp and cordova build hooks. The submodule idea could be a better option as I could manage versions more easily.
I would go along the lines of a git submodule or if you are happy with private bower/npm repos you could move it into there if you wanted stricter versioning.
But that’s how I’m approaching similar projects and I use the task runner to buildout a project ready for a new customer.