0

I use a lot of sprites in my css and all the location to the images has been hardcoded within the css. Now i am planning to move all images to a CDN. Its very hard to change the path in each and every place. Is there a way, to place the location as a variable in config file so that i need not change the path at all places when i move to another CDN. I am using python and django environment. My sample Code:

 #header .topriglogin .telephone{background:url(../images/sprites.gif) -314px -183px no-repeat;}

My expectation:

#header .topriglogin .telephone{background:url(CONFIG.SPRITE_LOCATION+'sprites.gif') -314px -183px no-repeat;}

is it possibele?. please advise

Vivek S
  • 5,384
  • 8
  • 51
  • 72

1 Answers1

0

You might consider to use LESS stylesheets which would allow you to use variables, in this case you still need to update the PATH config your own (or write a simple script that does that for you).

@SPRITE_LOCATION: '..path/to/sprites/'
#header .topriglogin .telephone{background:url(@SPRITE_LOCATION'sprites.gif') -314px -183px no-repeat;
Tommaso Barbugli
  • 11,781
  • 2
  • 42
  • 41