Cut Your PhoneGap Build App Size In Half With This One Weird Trick!
Aug 22, 2016 · Comments PhoneGapCordovaI’m in the midst of wrapping up my first Pluralsight course on PhoneGap Build Fundamentals and stumbled upon this today: if you include a special file into each icon and splash screen image directory, PhoneGap Build will only include the platform specific icon/splash files in each app binary created.
For years now (and I suspect I’m far from the only one), I’ve assumed that PG Build already does since, since we specify the image file paths in the config.xml file. Nope! All images are always included. Include a PGB Omit file with no file extension (.pgbomit) into each icon/splash directory. I tested it with the app I’m building for the course:
- Before: 6.4MB
- After: 3.3MB
Basically half of the original size! Awesome.
Details can be found at the newly revamped PhoneGap docs page:
A typical use case is for a directory containing the icons and splash screens for an app. Place
.pgbomit
in that directory and none of those files/directories will be included in the binary app package, except those copied and used for icons and splash screens for a specific platform.