Multiple projects one codebase


I was curious if there is any one out there that has successfully created an Ionic project code base that can serve up multiple projects. I am currently using, but wanted to see if this community had any insight on modifying ionic specific apps with a custom build process on one code base.

I am trying to accomplish a single codebase where I can run a custom cordova/ionic command that will build out a different app based on an identifier for the different app. I am running into issues on trying to figure out how to remove the www folder (or have another www folder i.e. www-1, www-2, www-3). This is also the same for the various platform folders, resources and config.xml.

My situation is I don’t want to have to recreate 30 different apps that are vary similar code wise and only vary by app name, id, resources, etc.

Any help would be greatly appreciated. If I am a little unclear please tell me and I will gladly go into further depth. Thanks in advance!


It would be similar to creating new targets in this generator


Did you have any luck finding a solution?


I sort of had this same requirement. I don’t know if my case is really similar to yours (from what I see it’s a little bit different), but anyway here is my situation and the solution that I came up with.

I had to develop two ‘related’ apps for a client which share a lot of code and UI styling, but which also have a lot of differences. A very rough estimate would be that it’s 50% to 65% “same” and 35% to 50% “different”. So, to be able to develop and maintain this efficiently I wanted to share a lot of code between the two apps.

The most ‘elegant’ way would probably be to make the common/shared stuff into npm or bower components which can then be added as dependencies to both apps. This would probably be a good way if you have a larger team or a distributed team, but in my case (working as a solo developer), I felt this was a bit overkill.

So what I did was simply to have 3 different Ionic projects, or to put it more precisely I have just one project (stored as one Github repo) with 3 main directories: 2 directories for the apps, and one “shared” directory.

Now in each of the 2 apps I simply created a “shared” symlink (using a Linux “ln -s” command) which points to the “shared” directory. I’m adding this symlink to the .gitignore to prevent the symlinked files being added to Git.

The ‘shared’ directory contains all stuff that I want share between the two apps: SASS styles, Angular directives (Javascript/HTML), and Angular services (Javascript).

I don’t share controllers or views (although theoretically I could, I suppose) but the controllers are kept light and simple anyway because I push as much as possible into services and directives.

This is a rather ‘low tech’ solution but it works for me, and it was the easiest and most practical way to do it.