Chapter 9. Packing options for Cordova projects

 

This chapter covers

  • Using config.xml to customize your Cordova project
  • Using merges for platform-specific modifications
  • Using hooks to enhance the build process

Whenever you create a Cordova project, you may have noticed that a file named config.xml is created in the root of the project, as shown in figure 9.1.

Figure 9.1. Typical Cordova project

9.1. Using config.xml to customize your Cordova project

You’ve not had to worry about the config.xml file until now, but go ahead and open it. The following listing contains the default config.xml for a project created at the command line with no additional arguments. (For example, not specifying the ID or application name.)

Listing 9.1. Default config.xml

This file is used by Cordova to define multiple different aspects of your application. You can see the ID value , which is used to uniquely identify the application, as well as the name . If you didn’t specify these at the command line, then you get default values.

If you had specified them like so: cordova create somefolder org.camden.myapp "My Cool App", you’d have seen them in the config.xml file:

<widget id="org.camden.myapp" version="0.0.1" xmlns="http://www.w3.org/ns/
     widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>My Cool App</name>

9.2. Using merges for multiple platforms

9.3. Using hooks to enhance the Cordova CLI

9.4. Summary

sitemap