I convert a CSS string to an AST, then to a plain object. Now I want to decide which At-rule to keep. In particular I want to do different things if it's a print rule. I.e. I want to distinguish between media queries and print queries.
> text=`@media print { a { color: red} }
... @media (min-width:100px) { a { color: blue} }
... `
'@media print { a { color: red} }\n@media (min-width:100px) { a { color: blue} }\n'
> csstree.parse(text).children
List {
cursor: null,
head:
{ prev: null,
next: { prev: [Circular], next: null, data: [Object] },
data:
{ type: 'Atrule',
loc: null,
name: 'media',
expression: [Object],
block: [Object] } },
tail:
{ prev: { prev: null, next: [Circular], data: [Object] },
next: null,
data:
{ type: 'Atrule',
loc: null,
name: 'media',
expression: [Object],
block: [Object] } } }