Best way to use configuration in the Ionic build process? - feedback on my approach


#1

I’ve been getting started with Ionic & Gulp recently.

I needed a way to control which environment (to handle different API hostnames between development / staging / production) my app was being built for. I couldn’t find much discussion about this in the forums - this was about the only thread I could find: Application environment configuration and as best I could tell, the Yeoman generator doesn’t handle this kind of config.

Replacing text to insert the required configuration makes sense, but I wanted to figure out how best to approach this. I didn’t want to run replace on the www/ directory.

I ended up setting up an app/ directory for all of my JavaScript, and then writing some Gulp build tasks to preprocess/compile everything and place the resulting code in the www/ directory.

I’ve created a template app showing how I’m configuring the app and a README describing my Gulp tasks: https://github.com/shedd/ionic_build_tools

Any feedback on this approach? How is everyone else handling this? Any other examples to look at? Thanks!