CSS rewrite not working

Hi, I seem to stumble across many issues in the current project im working on, that I can’t even replicate on other grav installations.

For some reason the relative urls in my CSS files are not being rewritten, even tho its enabled.

If i enable CSS pipelining and CSS rewrite the output for any background image in my css follows the following path/pattern.

grav/images/cd-top-arrow.svg

whereas it should be

grav/user/themes/themename/images/cd-top-arrow.svg

The moment i turn off CSS pipelining its working fine again.

I tried to replicate this on 2 different grav installations that i have running and there it works fine.

anyone else had this problem?

I never used CSS rewrite but isn’t it a special option for windows webhost? What is happening when you just turn on CSS pipeline without CSS rewrite?

Pipeline without CSS rewrite results in the img path being incorrect.

Normally, to my understanding, the CSS rewrite would rewrite the URL to a path that is correct. At least that how it works on my other installations.

The problem I have now is that with Pipeline enabled the image path breaks. And enabling CSS rewrite doesn’t seem to do anything at all.

I believe the windows webhost specific setting you refer to is “CSS minify Windows override”, but I have not enabled that setting.

ohh, right, I got confused between the two options. Maybe a temporary fix is adding {{ theme_url }} before your url

You should use relative URLs in your CSS. Such as:

../images/cd-top-arrow.svg

These should be processed correctly.

The URL in the CSS is relative, and works as it should. The problem surfaces once I enable CSS pipeline.

e.g.

background: #fff url('../images/menubg.jpg') no-repeat;

results in:

grav/images/menubg.jpg

should have been:

grav/user/themes/themename/images/menubg.jpg
---

I’m pretty sure this works on my setup, but can you create an issue here: https://github.com/getgrav/grav/issues so I can track it and look at it next week.

Thanks!

Hi Rhukster, I just double checked it again on a different installation, same server etc. where it’s working. The relative URL is rewritten and the output is correct.

Could there be any other setting that influences this?

I can’t really say for sure what the cause is unless i can try to recreate it myself. If you open an issue and attach a copy of your user/ folder, i can do so.