Append appropriate domain value to custom js file placed in clientlibs
Hi All,
I have a js file[which has logic to render some banner like content on page] which is placed under etc/clientlibs[but not mentioned in js.txt, to avoid conflicts with other custom files]. Here in this file am referring some images from /etc/clientlibs/images folder. While its in AEM, the images referred from /etc/clientlibs/images location will work fine, but this js file can also be referenced by any other page on any other website[to render banner on any site basically].
I need to append the appropriate domain before /etc/clientlibs/images being referred in the js file,so that this js along with some styling copied on any site works fine. I am getting the domain value from backend by a java method[i.e, if I do data-sly-use.config="com.xyz.abc" and in my html if I have
<script src="${config.Domain}/etc/clientlibs/.../abc.js"></script>.
But I am not getting how do I do this in custom js[say abc.js] file I have.