ben-eb / css-values

Validate CSS property value pairs.
MIT License
63 stars 3 forks source link

Cover 100% of properties & values accurately #5

Open ben-eb opened 8 years ago

ben-eb commented 8 years ago

Need to improve parsing & the code generator to be able to handle the more complex grammars, such as <color>.

zephraph commented 8 years ago

How could I go about trying to tackle this?

ben-eb commented 8 years ago

I've changed a lot about how this works now, hopefully it's less magical! For color specifically, I think it would be better to have a function that could validate any colour. So, we can start with https://github.com/ben-eb/css-values/blob/90a8116494cc8e35cdc672e32462f2faa1385fde/data/data.json#L6584 as a reference point; we need to be able to validate each of these value types (except the deprecated system colours, not bothered about supporting those).

So once we have an isColor validator, we'll need to have a special case in the property generator, as currently each of the validators accept a value rather than a node from postcss-value-parser. Perhaps that warrants changing first?

https://github.com/ben-eb/css-values/issues/8 is a good starting point if you want to get stuck in.

ben-eb commented 8 years ago

https://github.com/ben-eb/css-values/commit/ac7a06c70ae5b1c095e0f44af274b79dceb55562 adds support for <color>.

zephraph commented 8 years ago

you're fast >_>