Adobe AEM - How to combine clientlibs on the runtime

641 Views Asked by At

I want to combine the clientlibs on the page on runtime based on some conditions. For eg. I have the below items on the page

<link href="a.css" />
<link href="b.css" />

If I have a condition to enable concatenation, I want to combine these two css to a single one.

<link href="combined.css" />

Is it possible with Adobe Granite HTML Library Manager or HTML rewriter or some other option?

1

There are 1 best solutions below

0
Rohit Utreja On

You can create 2 Clientlibs and add css files accordingly. Use "embed" property in the clientlibs to render all files combined from both clientlibs at runtime.

Or

If you want to load these files individually, create 2 different clientlibs including respective css files. Load these clientlibs based on the conditions.