I’m wondering with the upcoming package management tools for cocos2d-html5 if the ability to avoid including code supporting WebGL is going to be included.
Currently I have been culling the size of my code and the cocos platform so it can be delivered as quickly as possible to mobile clients.
Currently I bundle my code and the cocos code in a single closured js file. It ends up being about 434k in total and 134k when zipped. The 434k is significant because JS on mobile devices is slow to load (and even more so in WebViews). The cocos portion represents 300k of the 434k and this is cocos on a diet as well (I’ve removed a number of files that my product does not currently use like particle effects and some of the complex math).
I haven’t gone to the level of commenting out what is essentially dead code on mobile (i.e. the webGL versions of all the basic nodes) and I can’t really see a way in the current code construction for the closure compiler to see that it is dead (maybe someone knows how to do this and I am going about it wrong).
I think ideally the WebGL and the Canvas implementations of these nodes might be better served in separate files so that both manually (or automatically via a package manager) a super lightweight mobile version could be generated by file level exclusion.
The alternative would be for me to comment out the code manually in all these files and do it each time for every cocos drop I integrate.