Created
January 14, 2016 20:21
-
-
Save josx/fc76006e6d877b17fefd to your computer and use it in GitHub Desktop.
Cordova Before build hook removing gz files (because aapt problem on compiling)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/** | |
* Lets clean up some files that conflicts with aapt. | |
* https://osvaldojiang.com/p/137 | |
* https://github.com/driftyco/ionic/issues/4584 | |
* http://stackoverflow.com/questions/4666098/why-does-android-aapt-remove-gz-file-extension-of-assets | |
* https://forum.ionicframework.com/t/android-build-failed-ionic-cordova-unable-to-add-asset-file-file-already-in-archive/41146 | |
*/ | |
var glob = require('glob'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var deleteFilesFromFolder = function(globExp) { | |
// Find files | |
glob(globExp, function(err,files) { | |
if (err) throw err; | |
files.forEach(function(item, index,array) { | |
console.log(item + " found"); | |
}); | |
// Delete files | |
files.forEach(function(item, index,array) { | |
fs.unlink(item, function(err) { | |
if (err) throw err; | |
console.log(item + " deleted"); | |
}); | |
}); | |
}); | |
}; | |
var globExp = path.resolve(__dirname, '../../www/lib') + '/**/*.gz'; | |
deleteFilesFromFolder(globExp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey just change poiting to your bower install libraries location.