I'm trying to preload assets like explained here.
I've included these in /apps/foundation/components/page/head.html
:
<sly data-sly-use.appConfig="${'../../../utils/AppConfig.js'}">
<link rel="preload" href="${appConfig.assetsURL}/etc/designs/myapp/jquery/jquery-3.1.1.min.js">
<link rel="preload" href="${appConfig.mainStyle}/mainstyle.css">
</sly>
Now the final files that need to be included are clientlibs.js
and clientlibs.css
which are put together for each page, having a different paths depending on the page. For example for homepage (/content/homepage.html) the path to clientlibs.js is /etc/designs/myapp/homepage/clientlibs.js
whereas for recent posts (/content/recent-posts.html) the path is /etc/designs/myapp/posts/clientlibs.js
The question is how do I compose the URL for these assets?
I tried using global variables from this gist but with no luck. Neither of them return the right path to the assets.