Reduce apk size - Ionicons necessary font files


We are about to publish an app to the stores and we are trying to make it’s size as small as posible. We are publishing both an android and iOS version of our app and we are embedding crosswalk(11) for android 4.x devices.

We are already minifying and merging all our files in one, but we have spotted another chance to reduce even more our apks.

We have noticed that ionic’s css code references all the ionicons font file formats:

@font-face {
    font-family: "Ionicons";
    src: url("../lib/ionic/fonts/ionicons.eot?v=2.0.1");
    src: url("../lib/ionic/fonts/ionicons.eot?v=2.0.1#iefix") format("embedded-opentype"), url("../lib/ionic/fonts/ionicons.ttf?v=2.0.1") format("truetype"), url("../lib/ionic/fonts/ionicons.woff?v=2.0.1") format("woff"), url("../lib/ionic/fonts/ionicons.woff") format("woff"), url("../lib/ionic/fonts/ionicons.svg?v=2.0.1#Ionicons") format("svg");
    font-weight: normal;
    font-style: normal; 

Looking at the @font-face browser support, it seems that the .woff format would be enough for our app.

Deleting the other font files would reduce the app size 500Kb more or less…

Is this a good idea? Is there anything I’m missing that would break something else?

thanks & regards

I think another place to look to is your images.
I normally don’t remove the icons (you never know), you may want to see if you can compress your images and minify them as much as possible.

As far as removing the extra icons, only way to find out is to test it out on a bunch of device/sims/vm.

Yes, images size was the first thing we reduced. But we have some static images that we must keep in the apk and this makes our img folder weight 1.5MB. We have reduced the size of all the images as much as it was posible.

We have a unique js file of 800KB that contains all the javascript code and all the html templates. And of course, we have a single css file that is 225KB more or less.

That makes our Android L release apk size almost 3MB.

The ionicons fonts folder is 700KB. If we keep just the .woff font file, we save a bit more than 600KB, making our app 2.25MB more or less.

We have tested it in several devices(androidL, android 4.x, iOS7 & iOS8) and nothing seems to get broken. The only thing that happens, is a 404 error when the ionic css code tries to load the .eot font file. This generates no problems because the .woff file fallback is called immediately.

We will test some more devices, but If we don’t detect any problem, we will go public with the .woff font file alone.

@jonmikelm How did this work out for you?

After testing it on several devices, we finally packed our app with only the .woff font file. We published our app in early summer and we haven’t received any complaint about the icons.

We used this solution for all our app versions: Android 4.x(xwalk), Android +5.x and iOS

Thanks, very valuable information :smile: Byebye, non-.woff font files.