Expand my Community achievements bar.

SOLVED

CQ Bug : CSS ClientLib and Protocol Relative URLs

Avatar

Level 4

Hi all,

 

I am using protocol relative URL in my CSS file and managing the CSS file using CQ ClientLib. "//" is getting coverted to "../../" by CQ when i hit the CSS file.

 

For example:

In my CSS I have a line like

background-image: url("//server.com/is/image/brandBar-sprite.jpg");

 

When we hit the final CSS the "//" get converted to "../../"

background-image: url("../../server.com/is/image/brandBar-sprite.jpg");

 

Read on one blog that this is CQ defect and to fix this we need to add "absolute:" before "//" so that CQ ignore the URL.

background-image: url("absolute://server.com/is/image/brandBar-sprite.jpg");

 

I came across this link for the resolution of this issue

AEM's CSSFileBuilder vs. Protocol-relative paths in ClientLibs

 

I donot want to put "absolute:" because UI team is also working and they are supplying the CSS file. I do not want to update the CSS file. Want to get rid of this manual step. Need some other solution .Just wondering if there is another solution for same issue.

 

Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 9

You can try pagespeed css rewrite filter

https://developers.google.com/speed/pagespeed/module/filter-css-rewrite

View solution in original post

2 Replies

Avatar

Correct answer by
Level 9

You can try pagespeed css rewrite filter

https://developers.google.com/speed/pagespeed/module/filter-css-rewrite

Avatar

Level 4

Thanks Mshajiahmed for your reply. Can you give one example configuration how this will work in my case.