Reputation: 652
Is there a way to partition Meteor client-side code so that only some of the code is packaged up to send to certain clients? For example, could all client-side code go to users who are "teachers," but only a subset of the client-side code go to users who are "students."
Of course, I could create two separate applications, but I'd rather keep the code base for multiple types of users together to ease maintenance.
Upvotes: 3
Views: 83
Reputation: 6974
As far as I know, there is currently no built-in way to load (i.e. send to the client) part of an app depending on the route, the user role, etc. You will have to either load everything for all users or build two applications sharing some private packages (this is pretty efficient actually).
There is also the possibility to store the javascript/template files in the public
folder (which content is not sent to the client, but on desktop only! see below) and to load them with $.getScript()
.
See for example this tutorial or this package. The latter might be what you are looking for.
But this might not work for a mobile app where the public
folder content is actually bundled at build time and re-sent to the client on each code push.
Upvotes: 2