The Problem
I have a large website, so my CSS folder structure can be rather deep. Any CSS file can set an element's background image via a relative URL. Before releasing to my production servers, I need to minify all CSS files. This minification process may break some of the relative URLs because it effectively flattens the folder structure. As a developer, how do you deal with this discrepancy between development and production code?
Example
This is my folder structure:
image/
article/
brushStroke.jpg
style/
module/
button.css
page/
article/
introToPainting.css
minified/
style20130522.css
During development, I may have this CSS rule in introToPainting.css:
#step1 {
background-image: url(../../../image/article/brushStroke.jpg);
}
Let's say on a particular simple page, I only need button.css and introToPainting.css. For production release, these two CSS files will be minified into style20130522.css. Now that the minified file resides in a different folder depth than introToPainting.css, the path to brushStroke.jpg is now wrong.