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 https://github.com/diegonetto/generator-ionic, 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!
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.