{"id":1235,"date":"2013-07-28T10:10:32","date_gmt":"2013-07-28T16:10:32","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/?p=1235"},"modified":"2013-07-23T14:55:38","modified_gmt":"2013-07-23T20:55:38","slug":"platform-specific-configuration-with-cordova-cli","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/1235","title":{"rendered":"Platform specific configuration files with Cordova CLI"},"content":{"rendered":"<p><a href=\"\/wordpress\/archives\/1225\">I previously posted<\/a> about using the <code>merges<\/code> directory to handle situations where your css or javascript differed between platforms.<\/p>\n<p>However, there are cases where platform specific Cordova configuration differs from that created by <code>cordova platforms add [platform]<\/code>.  In this case, if you want to <a href='\/wordpress\/archives\/1189'>version control<\/a> the configuration changes (and you should) you need to write a hook to copy over the configuration file from a well known location.  I create a top level directory called <code>config<\/code> and underneath that have platform specific directories.  <\/p>\n<p>However, there are two types of platform specific configuration to consider.  The first type aren&#8217;t modified by any other processes&#8211;application icons and splash screen images are examples of this.  In this case, your hook script can live in <code>.cordova\/hooks\/after_prepare<\/code> and be run every time.  Therefore, if you switch out a splash screen with a new image, it will show up the very next time you run <code>cordova build<\/code>.<\/p>\n<p>The second type of platform specific configuration file is one that is modified by other processes; for example, plugins often modify <code>AndroidManifest.xml<\/code>.  In this case, if you were to put the copying script into <code>after_prepare<\/code>, your plugin changes would be removed unless you reinstalled your plugins every time.  The better part of the build lifecycle in which to execute your copy script is <code>after_platform_add<\/code>.  This means, however, that when you need to change such files, you&#8217;ll need to remove and re add the platform (or merge your changes manually).<\/p>\n<p>In the next post, I will discuss adding plugins using Cordova CLI.<\/p>\n<p><a href=\"http:\/\/eepurl.com\/BHYJ9\">Subscribe to my infrequent Cordova newsletter<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I previously posted about using the merges directory to handle situations where your css or javascript differed between platforms. However, there are cases where platform specific Cordova configuration differs from [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64,7,60],"tags":[],"class_list":["post-1235","post","type-post","status-publish","format-standard","hentry","category-cordova-cli","category-mobile-technology","category-phonegap"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/1235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1235"}],"version-history":[{"count":6,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/1235\/revisions"}],"predecessor-version":[{"id":1289,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/1235\/revisions\/1289"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}