@msavin: Incremental loading isn’t all that important to me, but your theory is correct.
Blaze Templates can be passed in as helpers (that’s how my Blaze Modules package functions), so loading them via methods is pretty straightforward.
How incremental do you want to be… are just the templates lazy loaded, or are the JS files that reference those templates also going to be lazy loaded? If so, there needs to be a convention for storing them so the loader knows the 2 should be tied together.
Here’s a sample app that loads on demand a template from the “private” folder: https://github.com/nathantreid/blaze-lazy-example. It wouldn’t take too much to have that also import a .js file by the same name (or perhaps .blaze.js), and it would also be pretty straightforward to convert that into a build plugin that compiles all the server side templates and caches .blaze.js files, then sends them to the client on demand via a Method call.
5 Likes