I'm building a Cordova 3.5.0 application. I use grunt to build a minified web app, then I use cordova CLI and cordova hooks to build a platform specific package. I use more than 10 different plugins, some Cordova official ones and some custom. I'm wondering how to concatenate and minify the JS files from the plugins with my other 3rd party libraries.
After executing cordova prepare
I see a generated cordova_plugins.js
file with the following content:
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/org.apache.cordova.globalization/www/GlobalizationError.js",
"id": "org.apache.cordova.globalization.GlobalizationError",
"clobbers": [
"window.GlobalizationError"
]
},
{
"file": "plugins/org.apache.cordova.globalization/www/globalization.js",
"id": "org.apache.cordova.globalization.globalization",
"clobbers": [
"navigator.globalization"
]
}
];
module.exports.metadata =
// TOP OF METADATA
{
"org.apache.cordova.globalization": "0.3.1"
}
// BOTTOM OF METADATA
});
I know how to minify and generate a single file with these plugins but not how to tweak the cordova build process to get all clobbers from a single file but different packages. My first thought is all the process has to be accomplished in an AFTER_PREPARE step, inside the platforms/<platform>/assets/www
folder