blakeembrey / free-style

Make CSS easier and more maintainable by using JavaScript
MIT License
707 stars 29 forks source link

Feature Request: native CSS keys #17

Closed msavin closed 8 years ago

msavin commented 8 years ago

I like this idea, been wanting something like it for a while. I especially like how it's wrapped in an object, since writing CSS basically feels like writing objects.

Would it be possible to support native CSS keys? For example:

var STYLE = Style.registerStyle({
  backgroundColor: 'red'
})

To

var STYLE = Style.registerStyle({
  "background-color": "red"
}) 

That way, people can write CSS like they would expect to write it.

blakeembrey commented 8 years ago

@msavin This should already work, give it a go :+1:

Edit: The reason for camelCase is two fold - it's familiar to setting styles in JavaScript and it allows illegal identifiers (usually needing to be wrapped in a string like above) to be used. That said, if it's already dash-case nothing will be changed.