import { postcss } from "https://deno.land/x/bundler@0.6.5/deps.ts";
const { Container } = postcss;
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: (atRule: Rule, index: number) => false | void
Iterator receives each node and index.
Parameters
callback: (atRule: Rule, index: number) => false | void