Skip to content


Subversion checkout URL

You can clone with
Download ZIP


relative urls in CSS differ in development and production #186

dlee opened this Issue · 4 comments

4 participants


When CSS in the ./client directory refers to a relative URL for a background image, the resulting path is different in development and production. This is because CSS in development are loaded from localhost:3000/client/style.css, whereas CSS in production are loaded from *

We can't just say, "Don't use relative paths in CSS", because lots of third-party CSS libraries contain relative paths.

I can quickly propose two options for resolving this:
1. Serve CSS in production per folder, ie. *
2. Serve CSS in development from /, ie. localhost:3000/client_style.css


Yeah, this is a problem.

#2 isn't quite right because CSS relative paths won't usually include the "client" directory, particularly third-party CSS.

We probably need a CSS parser.


@debergalis Hmm... I don't see what's not quite right about option 2. I'm suggesting all CSS files get served from /, with modified names so there won't be clashes.


The other problem with relative paths in CSS files is concatenation/minification. Since that produces just one CSS file, from potentially multiple CSS files in different directories, the only way to support relative paths in CSS would seem to be to either parse the CSS and rewrite the paths in it as we go, or to intelligently group the CSS files during minification.

We should do something about this but the core team is unlikely to get to it soon. Curious to hear other perspectives/proposals.


Fixed in #1986 by @mquandalle

@Slava Slava closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.