1

Currently in my .scss file I have

.grid_pic {
    width : $width-grid;
    background : transparent url('/img/exemple_bg.png') 0 0 repeat;
}

Is there a way of removing the /img/ and to define a variable, OR a configuration files that tells to prefix all the images with the value I want ?

So the day we decide to serve our images via CDN, we just have to change 1 config line from /img/ to http://cdn.example.com/ instead of changing all the Url of the images ?

How would you achieve that ? (a variable or is there already a config for that ?)

Thanks.

sf_tristanb
  • 8,725
  • 17
  • 74
  • 118

2 Answers2

4

Try the interpolation syntax along with a variable:

background: url(#{$path_variable_name}/site/background.jpg);
Chris
  • 26,544
  • 5
  • 58
  • 71
0

did you try with image-url function ?

http://compass-style.org/reference/compass/helpers/urls/#image-url

benji07
  • 164
  • 3