-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RCSS rule priority #20
Comments
Ugh, my knee-jerk reaction is no to |
Yeah, I don't like |
facebook/react#1881 |
Makes sense. I think we can just leave this issue be if we support using the style object inline (which we do now). |
I've been experimenting with converting a large LESS-based webapp to RCSS (or, at least, converting a few React components). One problem I've run into several times is that RCSS classes are pretty low in terms of style precedence. In other words, if I convert a single React component to RCSS, there are often some lingering LESS selectors with higher priority that negate a lot of changes (to make things worse, the larger the nesting, the higher the priority of the selector, per CSS-tricks).
As a work-around, I've had to utilize "!important" in an ugly way, so much so that I've considered adding an "auto-!important" option to RCSS.createClass that simply appends "!important" to every rule.
For illustrative purposes, it's also worth considering this proposal, where they apply styles inline, rather than through CSS classes, which immediately skirts around this issue of precedence.
It'd be good to have a discussion about whether or not this merits addressing (in a fully-RCSSified webapp, it wouldn't really be a problem) and what the potential workarounds might be. Intuitively, adding "auto-!important" actually seems weirdly reasonable, given that adding an RCSS class to a React component is such a deliberate move that it should be considered the most important styling.
The text was updated successfully, but these errors were encountered: