Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

generating clientlib from java


Level 3

Hi Guys,

I'm trying to add clientlibs from my java class into my template component:

<sly data-sly-use.css="${'getCSS' }" > <sly data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}"> <clientlib data-sly-call="${clientLib.css @ categories=[css.clientlibname]}" data-sly-unwrap/> </sly> </sly> public class getCSS extends WCMUsePojo{ private String clientlibname; public String getClientlibname(){     return clientlibname; } @Override     public void activate() throws Exception {         clientlibname = "geometrixx-main";     } } css.clientlibname is having my clientlib name which is coming from my , but on my page this CSS is not applying.

I tried to put entire line 

<clientlib data-sly-call="${clientLib.css @ categories=[css.clientlibname]}" data-sly-unwrap/> into clientlibName from java and tried to put css.clientlibname in my page but that only print out the entire syntax on page instead of applying the css:
<clientlib data-sly-call="${clientLib.css @ categories=['geometrixx-main']}" data-sly-unwrap/> </sly>

Please let me know if anyone has a reply for this.

1 Reply


Level 4


Out of curiosity: would this work after dispatcher/apache started to cache the generated .html?

I mean: is this "dynamic library selection" based on something like a sling selector?
Otherwise, I think even if you fix the current issue, you'll face a cache issue later.