Cleaning up /www/lib/ionic for distribution

Hey,

I just started cleaning up my files to make it ready for distribution and release. That means optimizing lots of images and getting rid of all the unneeded stuff in /www/lib. One folder that really surprised me is /www/lib/ionic/ - it’s huge!

So I dove in, and deleted all the stuff I think I don’t need in production:

  • /www/lib/ionic/scss/*
  • /www/lib/ionic/css/*

I am obviously using ionic setup sass and now think that I could get rid of the source scss files and the “normal” css file that I don’t use.

Did I miss anything or shouldn’t I have deleted some of these?

Ionic starters provide you with a minimal gulp build process, it’s far from being ready for production.
One major issue is that it puts everything in www, rather than using a source foder and building to www.
So either you improve it, or you use a better existing one.

1 Like

beside of that there are many stuff you can do… like concat templates, and concat+minify js-files, run optipng and optiimage to optimize your resoureces.

i wrote a little tool for me with electron framework of the github makers. there i can login to my gitlab account --> clone a project, make some settings and at the and it builds my release app by doing extra steps. With the electron framework i can use any node-module i want. :smile:

I do not like to change my dev-app and have the whole build stuff in my development project. so i create a new production project —> change anything there.

I had it to often to change something for production and it magically lands in my dev -repo ^^

If you are using VS2015, you can use the below cordova plugin: https://github.com/MagicBoxSoftware/vs-cordova-3-1-ignore-files. I am not sure if it will work with regular ionic projects or not.

However, you should be able to do something similar with the after_prepare hooks, e.g. https://gist.github.com/agustinhaller/426351993c70a0329ad0 (note: I have not used this personally).

Exactly, that’s what I am working on - and trying to find out what exactly could/should be done in there regarding the /www/lib/ionic folder. Which files can I get rid of in there? Which do I have to keep although it doesn’t look like it?[quote=“bengtler, post:3, topic:37507”]
i wrote a little tool for me with electron framework of the github makers.
[/quote]
Link?[quote=“darshanp, post:4, topic:37507”]
If you are using VS2015, you can use the below cordova plugin: https://github.com/MagicBoxSoftware/vs-cordova-3-1-ignore-files. I am not sure if it will work with regular ionic projects or not.
[/quote]
Thanks, looking at the source can give me some ideas what I can get rid of in general: https://github.com/MagicBoxSoftware/vs-cordova-3-1-ignore-files/blob/master/remove-excess-files.js[quote=“darshanp, post:4, topic:37507”]
However, you should be able to do something similar with the after_prepare hooks, e.g. https://gist.github.com/agustinhaller/426351993c70a0329ad0 (note: I have not used this personally).
[/quote]
That one is also interesting and looks a lot more like what I want to have/build/use. Thanks!

I think main-bower-files helps you to include only the required files from your bower_components floder into your www/lib.
At least I think this is how generator-m-ionic does it, it does everything I need so I did not look at the details