I would like to develop a web application for browser and mobile application with Cordova. I want to maintain only one code base and have Cordova references to the code for the web application. Right now I have the code for web application in one folder and a Cordova project in another folder.
Cordova can use most of the code for the web application, but I need to add some code for mobile specific behaviors which are not applicable to a desktop browser. In this case, I don't want to add those to the code for web application.
So I'm seeking a good practice of sharing code among web application and mobile application (There's also one problem that's not solved. Cordova hardcode www and the source for the web application is in another location). And I'm new to Cordova. I'm not certain which is better to serve those html, js, css files in mobile application. Should I pack all of them into the app or load the ones on demand when the app is running.