I am developing a jQuery mobile app. In this app, i often use Mustache.js templates in separate html files. Actually, every template is needed by the user, but my app loads a template (via GET method) only when it is needed.For now, all the templates are small and they're all used by the client at runtime. But obviously this won't be the case for long, in case I add extensions that will be needed or not by the users.I could load every template at once, but I'm afraid this could become a blocking point in the future.Based on your experience, what is the best thing to do? Load all templates at once, or load them one by one, when needed?
Load all templates at startup?
jquery;html5;templates
When your users are working with smatphones and slow internet connections (gprs, 3g, etc) you should reduce the number of async loaded templates. Cause the low latency networks will slow down your app or maybe break it completely at a request timeout.On the other side it makes no sense to load so much data in the first initial request if you're talking about hundrets of templates which won't be used, cause your users only see 3 or 5 views. So it depends on your app, the users and their environments.A better approach would be a seperation of all code (Views + JavaScript) by some kind of area or category of your app. Then the user only has to load what he is currently using.