Currently, for things like background images, our css files have no domain specified. This works both in our development and production environments.
background-image: url(/images/bg.png);
For performance reasons (cookie-less domain), we’d like to switch this:
background-image: url(http://staticimagedomain.com/images/bg.png);
Ideally, we don’t hard code those, so our development environments can still pull locally.
Any thoughts on how to best achieve this?
I would suggest hosting the CSS files in the cookie-less domain as well, and not just the images. Then you would be able to use relative paths, which will work both in production and in any other environment.
If you deploy your CSS file to the cookie-less domain:
Then you can leave the relative URLs
/images/bg.png, which will work fine from both environments.CSS files don’t need cookies anyway.