User script namepaces based on folder
Is your feature request related to a problem? Please describe.
I have a number of scripts that are currently organised in subfolders in the custom scripts folder. However, Templater renders these in the API as entirely under the same namespace of tp.user.
Describe the solution you'd like
Perhaps adding an option to allow Templater to render folders under the scripts directory as a namespace/collection for scripts?
e.g. scripts/formvalues/ratingselect.js is made available as tp.user.formvalues.ratingselect()
Describe alternatives you've considered I'm not sure there are any alternates available here?
Additional context This is probably going to break backwards compatibility for others so this might need to be enabled in settings.
You can always make your own namespaces by returning multiple functions from a single function, for example:
module.exports = function() {
return {
ratingselect: () => {
// ...
},
// ...
};
}
tp.user.formvalues().ratingselect()
Closing this in favor of #1607 , these two are not compatible with each other.