Reputation: 21872
When developing a Cordova/Phonegap app, once the initial setup is in place, typically all that is needed is to periodically sync the www/ directory with each platform you are targeting, and test. Running "cordova build" works, in that regard, but it is really slow and does a lot more than just synchronize the www/ directories.
The documentation for the Cordova CLI api is somewhat meager… it says which commands you need to run to get your apps running on various platforms, but says very little, if anything, about what each command actually does or is supposed to do. Is it even necessary to run "cordova build" after the project is initially set up? Or is there another (faster) CLI command for just syncing the www/ dir when I want to test a small change? I tried "cordova prepare", but it only seems to build the config.xml file for each platform. Is the slow "cordova build" command really the only way prepare my app for testing (aside from building my own, custom synchronizer)?
On a side note, it's not just the slowness of the "cordova build" command that is holding me up, the command is also somewhat fragile. I have a separate stackoverflow question for a specific problem I'm having with it, but I'm hoping the "build" command might be avoidable altogether and that someone might know of a better synchronizing command that the referenced documentation doesn't cover and/or know of some better documentation for the CLI API.
Upvotes: 1
Views: 2213
Reputation: 1278
I don't know how, but myproject/platforms/android/assets/www/index.html
automatically updated when I save myproject/www/index.html
(At least 3 years later). I use cordova 6.5.0 in Atom editor on Windows 10.
It's a miracle! What is this space technology? I would appreciate if someone explain how it works.
Upvotes: 0
Reputation: 1485
cordova prepare
update www
folder too.
more specifically :
- prepare [platform...] copies files into the specified platforms, or all platforms. It is then ready for building by Eclipse, Xcode, etc.
- compile [platform...] compiles the app into a binary for each targetted platform. With no parameters, builds for all platforms, otherwise builds for the specified platforms.
- build [platform...] an alias for cordova prepare followed by cordova compile.
ref: https://github.com/apache/cordova-cli#project-commands
Upvotes: 5
Reputation: 4978
I typically work out of the www
directory directory. I use the browser for development, and only use cordova build
when I'm ready to test in the emulator.
I don't think there's a faster way to property sync the www
directory. You can use rsync, but that will only work for html, js and css files, and won't execute any hooks that may be injecting configuration data.
Does your application use native functionality? If so, can you mock it up in javascript and do your mainline development out of the www
directory?
I wrote a book about Cordova CLI and development processes that you might want to check out that explains the above process further. (If this reference is too much self promotion, please just comment and I'll remove it.)
Upvotes: 0