FormidableLabs / radium

A toolchain for React component styling.
http://formidable.com/open-source/radium/
MIT License
7.39k stars 308 forks source link

JSON Schema for style #640

Open tad-lispy opened 8 years ago

tad-lispy commented 8 years ago

Is there any schema definition for Radium style? I may need to implement one in JSON Schema format and would like to avoid re-inventing the wheel. Any advice would be highly appreciated :)

Do you think this project would benefit from such a formal definition? I'm thinking #610

ianobermiller commented 8 years ago

You are basically asking for a JSON version of the CSS specification :) I think this would be an interesting thing to do, but likely the weight would not be worth shipping in production Radium.

tad-lispy commented 8 years ago

Seems like we only need properties and values + media queries + state pseudoclasses, but without selectors, pseudoelements and more esoteric features like variables. For starters I'm thinking about listing all the possible properties. Even this seems like a big challenge - it's hard to find comprehensive list of them.

Side note: someone did it for React Native: https://github.com/awnist/react-native-style-json-schema/blob/master/src/schema.cson. It doesn't seem complete though.

ianobermiller commented 8 years ago

The React Native list won't help us, they purposely only support a specific subset of CSS.

tad-lispy commented 8 years ago

There is an official list of all properties with possible values for CSS 2.1, but anything above it (so called CSS 3) is a huge mess of overlapping recommendations. Most of them have property index, so it may be possible to extract something from there.

/cc @chameleonlizzard

tad-lispy commented 8 years ago

Seems like @rtfeldman did something similar for Elm https://github.com/rtfeldman/elm-css/

kevinSuttle commented 8 years ago

Relevant: https://github.com/pascalduez/postcss-map/issues/76