mapbox / carto

fast CSS-like map stylesheets
https://cartocss.readthedocs.io/
Apache License 2.0
652 stars 129 forks source link

Does mss support overrides? #425

Open OnkelTem opened 8 years ago

OnkelTem commented 8 years ago

Or rather - why doesn't it support overrides? This is trivial thing. And obvious (see CSS).

tmcw commented 8 years ago
OnkelTem commented 8 years ago

Thanks for quick reply.

Under "obvious" I meant: when there's something similar to a thing which you're familiar with, you'd expect it to behave similarly. So if I have two files: file1.mss

#roads {
  text-size: 12;
}

file2.mss

#roads {
  text-size: 14;
}

included in this order, then the final text-size becomes 12, not 14.

tmcw commented 8 years ago

You might want to try those in reverse, earlier rules can win in CartoCSS.

While we'd like CartoCSS to have very similar to CSS, it's important to remember that it isn't CSS: it isn't interpreted by a browser, and does not style elements. None of the precedence, overriding, or interpretation of the language comes 'for free', and the codebase is, in some places, just as complex as a browser - because it's doing the job of a browser.

OnkelTem commented 8 years ago

You might want to try those in reverse, earlier rules can win in CartoCSS.

That's not redefining, it's more a pre-defining which is not convenient in some respects. For example I can't redefineshield-min-distance property because it requires also defining shield_file, but referencing files in not my style responsibility. (Also I doubt if styles are actually augmented later when encountering the same selector.)