PhoneGap CLI and Templates

A few days ago the PhoneGap team announced an update to the CLI: PhoneGap CLI 5.0.0 Released!. To be honest, I don't typically make use of the PhoneGap CLI as I mostly use either Cordova or Ionic. However, I missed an earlier update that I think is pretty cool (and it is one I was able to help out with) - template support.

When creating a PhoneGap project, you can request a template to be used instead of the default PhoneGap project. You've been able to copy from a directory for a while now (using --copy-from or --link-to), but this new feature lets you specify from a set of templates that might be useful for seeding a new project.

To see what templates exist, you execute: phonegap template list (you can also replace template with recipe):


There are only four templates so far, but more will be coming in the future. I've said before that I'm not a fan of the default template used by both Cordova and PhoneGap, so I'm happy to see blank as an option. The jQuery Mobile template is one I built. To use a template, you simply use --template name when creating your application.


My template includes the latest jQuery Mobile assets, and includes JavaScript code that will fire a method when both jQuery Mobile and PhoneGap is ready to run. If you're curious, you can see the repo here:

Like This?

If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can also subscribe to the email feed to get notified of new posts.