Absolute url in CSS images url

Hi, I am wriframing a custom theme directly in CSS and I am using placehold.it for images placeholder also in CSS backgrounds.

The problem is that I am getting the addresshttp://localtest:8888/themes/custom-theme/http://placehold.it/36x36... in my CSS.
Is there a way to avoid it at least in development env?

View Replies: View Best Answer
citytech2 replied on at Permalink Reply
I think you are trying to call the images directly from the placehold.it, if so then you have to remove the absolute path. I think there was a code like
<?php echo $this->getThemePath(); ?>
just before your images path. remove this path.

carusog replied on at Permalink Reply
Hi and thank you for your reply.
Yep, I am trying to get it from placehold.it but that should be fine, it is just like it is meant to be and it works elsewhere.
The issue is that in my CSS file I have the following declaration:

#support-request h2 {
    background: transparent url("http://placehold.it/36x36") no-repeat 0 0;}

But it is changed (by Concrete5?) to this:

#support-request h2 {
    background: transparent url("http://localtest:8888/themes/custom-theme/http://placehold.it/36x36http") no-repeat 0 0;}
citytech2 replied on at Permalink Reply
Hi carusog
Try to remove the double quotes(""). I think it will work.

carusog replied on at Permalink Reply
I thought about it, but no, same issue. :/

It also adds back double quotes.

Could be some settings in the C5 installation?
MoonGrab replied on at Permalink Best Answer Reply
Try not using the getStyleSheet function.

Like that:
<link rel="stylesheet" href="<?php echo $this->getStyleSheet('layout.css')?>" type="text/css" />

In this code I would replace:
<?php echo $this->getStyleSheet('layout.css')?>

<?php echo $this->getThemePath(); ?>/css/style.css

Try that, although I'm not sure if this will work.
carusog replied on at Permalink Reply
And the winner is: "MoonGrab!" :D

It works. I didn't expect the getStyelSheet() function would process the file but, yep, that was the problem.

But, now, the question is "why to process the file to add absolute links to assets"?
MoonGrab replied on at Permalink Reply
Many reasons, but the bottom line is - because it works perfectly.
Rewrites and s#$t.

Don't think about it, just accept it. It's better this way xD

PS: might wanna my answer as a "best answer" so people can find it easily.
mkly replied on at Permalink Reply
I remember correctly putting the url in single quotes prevents getStyleSheet() from rewriting it
body {
  background-image: url('http://thisshouldnotberewritten');

But my memory is fuzzy so I might be wrong.

getStyleSheet is designed to rewrite the urls to point within the theme directory from a relative file and also it is used to fill in the customisations available at Themes->Customize. If you don't use getStyleSheet() those won't apply. So as long as you don't need either of those features you'll be fine.

edit: css braindead