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

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 8

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 8

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.