CSSTree's AST is an object tree. Each node is object with type
property that indicates its type. Other property set depends on node type.
Each node have a loc
property, but not included in descriptions to avoid noise. Its value contains an object with node content positions in source string or null depending on parsing settings.
Node types:
- AnPlusB
- Atrule
- AtruleExpression
- AttributeSelector
- Block
- Brackets
- CDC
- CDO
- ClassSelector
- Combinator
- Comment
- Declaration
- DeclarationList
- Dimension
- Function
- HexColor
- IdSelector
- Identifier
- MediaFeature
- MediaQuery
- MediaQueryList
- Nth
- Number
- Operator
- Parentheses
- Percentage
- PseudoClassSelector
- PseudoElementSelector
- Ratio
- Raw
- Rule
- SassInterpolation
- SassPlaceholderSelector
- SassVariable
- Selector
- SelectorList
- String
- StyleSheet
- TypeSelector
- UnicodeRange
- Url
- Value
- WhiteSpace
{
"type": "AnPlusB",
"a": String | null,
"b": String | null
}
{
"type": "Atrule",
"name": String,
"expression": <AtruleExpression> | <MediaQueryList> | <SelectorList> | <Raw> | null,
"block": <Block> | null
}
{
"type": "AtruleExpression",
"children": List
}
{
"type": "AttributeSelector",
"name": <Identifier>,
"operator": String | null,
"value": <String> | <Identifier> | null,
"flags": String | null
}
{
"type": "Block",
"children": List
}
{
"type": "Brackets",
"children": List
}
{
"type": "CDC"
}
{
"type": "CDO"
}
{
"type": "ClassSelector",
"name": String
}
{
"type": "Combinator",
"name": String
}
{
"type": "Comment",
"value": String
}
{
"type": "Declaration",
"important": Boolean | String,
"property": String,
"value": <Value> | <Raw>
}
{
"type": "DeclarationList",
"children": List
}
{
"type": "Dimension",
"value": String,
"unit": String
}
{
"type": "Function",
"name": String,
"children": List
}
{
"type": "HexColor",
"value": String
}
{
"type": "IdSelector",
"name": String
}
{
"type": "Identifier",
"name": String
}
{
"type": "MediaFeature",
"name": String,
"value": <Identifier> | <Number> | <Dimension> | <Ratio> | null
}
{
"type": "MediaQuery",
"children": List
}
{
"type": "MediaQueryList",
"children": List
}
{
"type": "Nth",
"nth": <AnPlusB> | <Identifier>,
"selector": <SelectorList> | null
}
{
"type": "Number",
"value": String
}
{
"type": "Operator",
"value": String
}
{
"type": "Parentheses",
"children": List
}
{
"type": "Percentage",
"value": String
}
{
"type": "PseudoClassSelector",
"name": String,
"children": List | null
}
{
"type": "PseudoElementSelector",
"name": String,
"children": List | null
}
{
"type": "Ratio",
"left": String,
"right": String
}
{
"type": "Raw",
"value": String
}
{
"type": "Rule",
"selector": <SelectorList> | <Raw>,
"block": <Block>
}
{
"type": "SassInterpolation",
"children": List
}
{
"type": "SassPlaceholderSelector",
"name": String
}
{
"type": "SassVariable",
"name": String
}
{
"type": "Selector",
"children": List
}
{
"type": "SelectorList",
"children": List
}
{
"type": "String",
"value": String
}
{
"type": "StyleSheet",
"children": List
}
{
"type": "TypeSelector",
"name": String
}
{
"type": "UnicodeRange",
"value": String
}
{
"type": "Url",
"value": <String> | <Raw>
}
{
"type": "Value",
"children": List
}
{
"type": "WhiteSpace",
"value": String
}