Skip to content

Instantly share code, notes, and snippets.

@csantanapr
Forked from revolunet/cordova-tips.md
Last active August 29, 2015 14:27
Show Gist options
  • Save csantanapr/cf74348430617b523180 to your computer and use it in GitHub Desktop.
Save csantanapr/cf74348430617b523180 to your computer and use it in GitHub Desktop.
Cordova iOS tips

General

  • create a single page javascript application
  • be as low-level as possible to be able to control performance (=minimize layers)
  • masterize your dev/build environnement so you can work/play nicely

Debug apps

Compilation

To prevent massive app recompilation and wasted time, build your app once with <content src="http://192.168.0.11:9888" /> in config.xml and point it to your computer dev server, in the platforms/ios/www folder.

Then use cordova prepare to update the sources and Cmd+R in Safari debugger to reload the new version, or... livereload :)

Or use this before_prepare hook : https://gist.github.com/revolunet/328193b350a056d730a5

Plugins

Define your plugin dependencies with commit-ish reference in config.xml : <plugin name="nl.x-services.plugins.socialsharing" spec="https://github.com/revolunet/SocialSharing-PhoneGap-Plugin.git#f7e938cf06e1705727b501b4e6e184b535445341" />

cordova prepare is supposed to reinstall missing plugins but can fail silently for some reasons...

Plugin dev

  • use cordova plugin add --link ../path/to/awesome-plugin/ to create a symbolic link to your project dev folder
  • plugins dependencies can have specs too plugin.xml : <dependency id="cordova-plugin-dialogs" url="https://github.com/revolunet/cordova-plugin-dialogs" commit="c70eb82adc8d11889ab47c01a686f692f60b1623"/>

Best practices

Performance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment