Skip to content

Commit ce0770e

Browse files
committed
Describe the structure of the returned value from canonicalize().
1 parent 6659bc5 commit ce0770e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ A `CSSGrammar` object is provided with a default grammar for CSS.
133133
If you call `canonicalize()` without a grammar,
134134
this is used automatically.
135135
136+
The return value is a nested structure of objects.
137+
Each has a "type" key, set to either "stylesheet", "qualified-rule" or "at-rule".
138+
Unless it's a statement at-rule,
139+
each has a "rules" key set to an array of contained rules/declarations.
140+
At-rules also have a "name" (string) and "prelude" (list of tokens for the part before the block).
141+
Qualified rules have a "declarations",
142+
which is an object mapping declaration name to value (list of tokens),
143+
for ease of use
144+
(all the declarations are in the `.rules` property already,
145+
but this gives you easy access to them by name,
146+
and only stores the last of each if they're repeated).
147+
136148
Node Integration
137149
----------------
138150

0 commit comments

Comments
 (0)