Build different apps depending on the environment with the same sources


I was wondering if there was an easy way to build different apps using the same sources.
I’d actually like to be able to build the app in “development mode” i.e. with a different name / id, so there would be two icons (app in devel and app in production).

It’s really not about the storage or the app configuration (like URLs and stuff), that can be handled dynamically or with a hook.
I just find it more convenient to keep the “production” app installed while I can keep developing another version aside.

I’ve tried to get this working by having a config.xml.tmpl and a before_prepare hook which replaces name and id, but it cannot work this way, the platform-dependent sources seems to be generated when the platform is added. Moreover the config.xml is copied even before the before_prepare hooks to run

Hav a look at environment option in projects generated by generator-m-ionic

Thanks but that’s not really what I’m looking for.
It generates a different application config depending on the environment, but at the end the config is embedded in the application just like an updated source file, and it builds the same app (same name and same bundle id).

I already use the same approach to handle a development / production mode.

Now, I’d just like to be able to build two different apps so I could launch one or the other, keeping a clean production version installed.

I’ve figured it out. The config.xml just needs to be generated even before the hooks, so using gulp or a script.

This is why they also provide programmatic ways to change config.xml
This is what I use to build “white label” apps from same source.

Looks cool, thanks. I ended up doing kind of the same thing, having a config.xml template and this gulp task:

var app = require('package.json');

gulp.task('set-config', function (done) {
    var appName = capitalize(, appBundleId = app.bundleId, appVersion = app.version;
    if (configName === 'development') {
        appName += ' DEVEL';
        appBundleId += '.devel';
    sh.exec("sed -r -e 's/@@APP_NAME@@/" + appName + "/' -e 's/@@APP_BUNDLE_ID@@/" + appBundleId + "/' -e 's/@@APP_VERSION@@/" + appVersion + "/' config.xml.tpl > config.xml", done);

It previously didn’t work because I was doing this in a before_prepare hooks which happens to be executed too late in the process for config.xml hacks.

Why don’t you people use stackoverflow? This forum sucks because the answers are not rated!

is this still working latest ionic framework ?