Disable css url rewrite inside clientlib | Community
Skip to main content
May 13, 2022

Disable css url rewrite inside clientlib

  • May 13, 2022
  • 1 reply
  • 2200 views

I am experiencing the exact issue logged more then 1 year ago on the AEM core components: https://github.com/adobe/aem-core-wcm-components/issues/1371. Basically this is what happens:

As you can see the url is rewritten and this makes sense when css is included using a link tag on a page but it causes a lot of issues when using inline styling which I am using to inline critical css. In my cases the font-face url is rewritten just like in the Github issue mentioned above. I've found Adobe docs mentioning this process: https://experienceleague.adobe.com/docs/experience-manager-64/developing/introduction/clientlibs.html?lang=nl&mt=false but I did not find any way to prevent this from happening, am I missing something?

 

All help would be appreciated!

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

arunpatidar
Community Advisor
Community Advisor
May 15, 2022

Hi,

can you try using proxy clientlibs and load image from resources folder

https://sourcedcode.com/blog/aem/how-to-serve-static-assets-in-aem-as-client-library-resources 

Arun Patidar
Level 2
May 17, 2022

It's me from a different account, @arunpatidar. We are using a proxy clientlib for the css file and we are not including images but we are including fonts and they live under a resources folder. Everything works when you are just including css using a link tag but not when trying to inline it. This just seems like a bug to be honest.

arunpatidar
Community Advisor
Community Advisor
May 17, 2022

Hi,

It could be a bug. One of the thing you can try is using relative path from root or use assets from dam?

 

div#header { 
  background-image: url(/etc.clientlibs/styles/bg-full.jpg);
}

div#header { background-image: url(/content/dam/myproj/styles/bg-full.jpg); }

Arun Patidar