I donβt know how to filter files for Cordova, but I can describe how you feel about what we use in our projects.
We use gruntjs with the phonegap plugin. We configure it to use a previously created folder (which contains only the necessary files and folders), and it:
- creates a cordova / phonegap project
- adds plugins, platforms
- creates own application
- runs its own application on the emulator
The main thing in this approach is that the cordova / phonegap project (a directory with .cordova, platforms and www folders) is just an assembly artifact.
Here is an example of our Gruntfile.js :
phonegap : { config : { root : './out/dist', config : { template : './config.tpl.xml', data: { id: pkg.id, version: pkg.version, name: pkg.name, author : pkg.author } }, path : 'out/phonegap', plugins : [ // PHONEGAP OFFICIAL PLUGINS 'org.apache.cordova.globalization', 'org.apache.cordova.network-information', 'org.apache.cordova.splashscreen', //THIRD-PARTY PLUGINS 'de.appplant.cordova.plugin.local-notification' ], platforms : [ 'android' ], maxBuffer : 200, // You may need to raise this for iOS. verbose : false, releases : 'out/releases', releaseName : function() { return pkg.name + '-v' + pkg.version; }, // Android-only integer version to increase with each release. // See http://developer.android.com/tools/publishing/versioning.html versionCode : function() { return 1; } } }
Note. out / dist is generated by the previous build phase and contains a concatenated and reduced version of the code.
Andrew Shustariov
source share