I've been kicking the tires on Phonegap and I'm getting started with my first real project.
One thing I haven't seen a solution for in the tutorials I've come across is project organization. Let's say I'm targeting Android and iOS.
I'll have one folder for the iOS stuff and I'll have one folder for the Android stuff. Both of these folders will have a www folder a couple of levels down and that's where all my code actually lives since the rest is just boilerplate for the different platforms.
Now how do I go about managing this without resorting to code duplication? The simplest strategy might be to just have the www folder live somewhere else and symlink to it from within both the iOS and Android code trees.
One step up from that would be to use some kind of build tool that runs before the iOS/Android compilers. This would facilitate stuff like build with unminified vs minified code and a lot of other options.
If I am to use a build tool, what are good/popular options? gruntjs seems to be gaining popularity with js-heavy projects. Is it a good fit for Phonegap?
I agree that there are very little documentation on the subject. This is also because they are still working on it for PhoneGap 3. They redid the entire project structure for PhoneGap 3 to create a standard way for organizing things. See this article: http://blog.safaribooksonline.com/2013/07/19/streamline-cross-platform-development-using-apache-cordova-phonegap-cli/
[Summary] Basically you have folders like:
/merges - for merging/overriding www folder
/platforms - contain native codes
/plugins - plugin codes
/www - primary folder web app folder
They have not gotten around to write any documentation because all of this is automatically created for you with nodejs and their cli tools. This project structure also help create consistency with their PG online build tools.
Personally, we do not use the online build tool. This is because we have some massive customization in our code and write our own native plugins. We also use node, gruntjs, and Jenkins (on osx) in our internal continuous integration build. This allow us to produce cross platform builds. We are not on PG 3 yet, but we use the same folder structure so hopefully it'll be a smooth upgrade.