Cordova's copy-from tip

Yesterday I was proof-reading a blog post about an update to the PhoneGap CLI (which you should read - PhoneGap CLI 3.6.3) and I discovered something interesting. For a while now the Cordova CLI has had the ability to create a new project based on another. This is great because the default Cordova/PhoneGap application annoys the heck out of me.

You can see this feature by typing cordova help create. Here is how the feature is documented:

--copy-from|src= ... use custom www assets instead of the stock Cordova hello-world. </blockquote>

Ok, nice and simple, right? So I built my own skeleton application with a minimal amount of code and just carried on my happy way. While reading that article about PhoneGap's update though I discovered this feature actually does two things.

If you point --copy-from at a folder that is not a Cordova application, it will copy the assets into the www folder of your new project.

If you point --copy-from at a folder that is a Cordova application, it will copy the www folder, the hooks folder, and the config.xml file. I had no idea that this was supported, and while I probably won't use the feature that often, it is good to know it exists. (And I'm going to file a bug report right now for the Cordova CLI to update the help text.)

p.s. As a reminder, definitely read that article about the PhoneGap CLI update. I primarily use the Cordova CLI but the PhoneGap one now has some features that Cordova does not. One of them I really like - if you try to run a platform that doesn't exist, it will simply add it for you. Nice.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments