~alcinnz/haskell-stylist

9f6bc1ae303fb3b9bf758dc7ccdc89271af4c301 — Adrian Cochrane 1 year, 6 months ago 3efc761
Adjust Readme to have clearer & more up-to-date instructions.
1 files changed, 1 insertions(+), 1 deletions(-)

M README.md
M README.md => README.md +1 -1
@@ 15,7 15,7 @@ The first major number indicates any other change to the API, and might break yo
## API
To parse a CSS stylesheet call `Data.CSS.Syntax.StyleSheet.parse` which returns a variant of the passed in `StyleSheet`. `StyleSheet` is a typeclass specifying methods for parsing at-rules (`parseAtRule`), storing parsed style rules (`addRule`), and optionally setting the stylesheet's priority (`setPriority`).

If these ultimately call down into a `Data.CSS.Syntax.Style.QueryableStyleSheet` you can call `queryRules` to find all matching style rules organized by psuedoelement. Once you have these style rules (typically by specifying a psuedoelement) you can call `cascade'` to resolve them into any instance of `PropertyParser`. To query rules not targetting a psuedoelement, you can either lookup the "" psuedoelement or use the `cascade` shorthand.
If these ultimately call down into a `Data.CSS.Syntax.Style.QueryableStyleSheet` you can call `cascade` to resolve them into any instance of `PropertyParser`. Or you can use `queryRules`/`cascade'` to handle the pseudoelements yourself before applying the cascade.

`PropertyParser` allows to declaratively (via Haskell pattern matching) specify how to parse CSS properties, and how they're impacted by CSS inheritance. It has four methods: `longhand` and `shorthand` specify how to parse CSS properties, whilst `temp` and `inherit` specifies what the default values should be.