HTML5 Zone is brought to you in partnership with:

Raymond Camden is a developer evangelist for Adobe. His work focuses on web standards, mobile development and Cold Fusion. He's a published author and presents at conferences and user groups on a variety of topics. He is the happily married proud father of three kids and is somewhat of a Star Wars nut. Raymond can be reached via his blog at www.raymondcamden.com or via email at raymondcamden@gmail.com Raymond is a DZone MVB and is not an employee of DZone and has posted 213 posts at DZone. You can read more from them at their website. View Full User Profile

Tip for PhoneGap Users - Modify the WWW template

01.29.2013
| 2167 views |
  • submit to reddit

Now that I've gotten comfortable with PhoneGap's command line I'm finding myself much more productive when building quick demos. The previous link will tell you more, but as a quick example, this is how I'd quickly dump out an IOS project.

ioscreate foldername org.camden.randomdemox RandomDemoX

"ioscreate" is not the name of a PhoneGap binary, but simply a symbolic link to the create binary from the PhoneGap iOS directory.

I then CD into the folder, run "subl www" to open the www folder in Sublime, and run "cordova/build && cordova/emulate" to run the build and emulate commands. This pops open the new application in my iOS simulator.

All of this takes about 2 seconds and works great, except for one small nit. By default, the new project has this fancy HTML.

You can't see it - but the green "Device Is Ready" is pulsating. It's very hypnotic.

What this means is that I actually spend more time "cleaning" the HTML, JavaScript, and CSS then I do actually creating the new project.

Luckily there is a quick fix for this. Given your desired platform, go to where you installed PhoneGap and you will see a "bin" folder and beneath that, a "templates" folder. There should be one folder underneath it.

See the www folder? Just edit the contents within there to your liking and the next time you create a project, your modifications will be used. Here's my version.

Ok, that's kinda boring, but I've got a nice blank HTML, JS, and CSS file ready to go in my editor.

Published at DZone with permission of Raymond Camden, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)