Is it possible to load templates at runtime?


#1

I have a really big application, there are lots of screens involved. Different facets of the UI are available to different users depending on login.
I would prefer not to download the whole application to the client. I have had a look at https://meteorhacks.com/how-blaze-works. I understand that the spacebars-compiler package generates htmljs which is sent to the client. Would it be possible to have this occur at runtime and cached on the client? Is there a routing system that provides this out of the box?
Thanks


#2

Hi,

Did you check Template.dynamic ?
http://docs.meteor.com/#/full/template_dynamic

It will let you load a template on the fly, or swap it based on an event.


#3

@mspi That’s not what he means, he means not downloading the actual template during initial load of the page.

@carbonman Although I would try to avoid it, there is a possible solution that uses files in the public (or private) folder and load them on demand: https://github.com/numtel/meteor-component-example

And the 2 packages:
https://atmospherejs.com/numtel/publicsources
https://atmospherejs.com/numtel/privatesources


#4

Thank you. I will definitely check that out. Looks like exactly what I am after.

Sorry for the slow reply, I didn’t get any email notifications for the thread. I need to work out how to do that.