Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

relative urls in CSS differ in development and production #186

dlee opened this Issue Jun 15, 2012 · 4 comments


None yet
4 participants

dlee commented Jun 15, 2012

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 *.meteor.com/hash.css.

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. *.meteor.com/client/hash.css
  2. Serve CSS in development from /, ie. localhost:3000/client_style.css

debergalis commented Jun 19, 2012

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.

dlee commented Jun 19, 2012

@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.


gschmidt commented Feb 6, 2013

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.


Slava commented Mar 31, 2014

Fixed in #1986 by @mquandalle

@Slava Slava closed this Mar 31, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment