kodyl / stilr

Encapsulated styling for your javascript components with all the power of javascript and CSS combined.
MIT License
236 stars 16 forks source link

neccesary nesting? #5

Closed nmn closed 9 years ago

nmn commented 9 years ago

Stilr supports pseudo elements by nesting them:

StyleSheet.create({
  x: {
    color: 'red',
    ':hover': {
      color: 'green'
    }
  }
})

However, it doesn't work if you don't nest the pseudo selectors:

StyleSheet.create({
  x: {
    color: 'red',
  },
  'x:hover': {
    color: 'green'
  }
})

This, creates two keys, with none of them with a :hover pseudo selector.

Is this on purpose? If not, perhaps it should be documented. (I'll do a pull request, just need your answer first)

chriskjaer commented 9 years ago

Yes, that's on purpose. All logic should be kept inside each class. It may be opiniated, but it makes it easier to see where everything belongs. ... it also keeps the Stilr logic simpler, which I like almost as much.

chriskjaer commented 9 years ago

Also, pull request are welcome! :+1:

nmn commented 9 years ago

would you like a PR for this?

chriskjaer commented 9 years ago

Yeah. Feel free to update the readme. If you have any interesting things to add, I'm open to that as well :)