johanholmerin / style9

CSS-in-JS compiler inspired by Meta's stylex
MIT License
570 stars 27 forks source link

Feature request: support nested selectors #46

Closed TxHawks closed 3 years ago

TxHawks commented 3 years ago

I'd like to have a way to specify rules for nested selectors, like:

style9.create({
  text: {
    color: '#333',
    '&>a': {
      color: 'blue',
    }
  },
});

Admittedly, this doesn't fit very well with the concept of atomic CSS. However, it is often a critical escape hatch in cases where we do not have control over the html, e.g., when dealing with text generated from markdown or wyiwg editors, and all other atomic-styling solutions I'm aware of support this feature to some degree.

johanholmerin commented 3 years ago

Not supporting selectors is a deliberate decision and not something that will change, as documented in Background. If that is something you need I suggest looking at another library.