Utilizing Sightly snippet inside template engine
I'm facing a situation where :
I want to invoke a clientlib cateogory (OOTB) once the markup is formed. Now, the particular markup is injected as compiled template (e.g. mustache) inside the root html where the OOTB clientlib is already invoked.
Example:
In the below format, clientlib of category core.abc.xyz is loaded with DOM prior to the execution of custom template getting injected. So, even if it is required the presence of "target" class in the html for some necessary clientlib actions (binded over this class), its not able to take place.
<div class ="root">
<sly data-sly-call="${clientLib.all @ categories='core.abc.xyz'}" />
<div>
<script id="result-template" type="text/x-handlebars-template">
{{#each this}} <div class="target"> {{/each}}
</script>
</div>
</div>
So, I want to know if there is any way to load a OOTB clientlib script via its category after any custom JS event e.g. on-click. There is a way to load it via relative/absolute path, (e.g. $.getScript()) but in case the libs script location gets changed, custom modules will get impacted.