I haven’t quite thought this one through yet, I might be overlooking something simple and obvious.
Is there a way to only deliver a JS files to certain users?
For example, I only want admin users to have access to an Admin object which contains a bunch of functions and calls. I’ve got that in a separate file in my client directory.
The reason isn’t for security (by obscurity) or anything - but rather, why would I want to send that JS asset to every client. It is something extra to download which has no value to that user.
The only thing I can think of would be to have the JS in the public directory - and the admin template that gets loaded can load that via a script element, but that seems pretty hacky.