import { Container } from "https://deno.land/x/postcss@8.4.16/lib/postcss.js";
Traverses the container’s descendant nodes, calling callback for each rule node.
If you pass a filter, iteration will only happen over rules with matching selectors.
Like Container#each
, this method is safe
to use if you are mutating arrays during iteration.
const selectors = []
root.walkRules(rule => {
selectors.push(rule.selector)
})
console.log(`Your CSS uses ${ selectors.length } selectors`)
Parameters
callback: (rule: Rule, index: number) => false | void
Iterator receives each node and index.
Parameters
callback: (rule: Rule, index: number) => false | void