Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Latest
method default.prototype.walkDecls
import { default } from "https://deno.land/x/postcss@8.4.16/lib/container.js";

Traverses the container’s descendant nodes, calling callback for each declaration node.

If you pass a filter, iteration will only happen over declarations with matching properties.

root.walkDecls(decl => {
  checkPropertySupport(decl.prop)
})

root.walkDecls('border-radius', decl => {
  decl.remove()
})

root.walkDecls(/^background/, decl => {
  decl.value = takeFirstColorFromGradient(decl.value)
})

Like Container#each, this method is safe to use if you are mutating arrays during iteration.

Parameters

propFilter: string | RegExp

String or regular expression to filter declarations by property name.

callback: (decl: Declaration, index: number) => false | void

Iterator receives each node and index.

Returns

false | undefined

Returns false if iteration was broke.

Parameters

callback: (decl: Declaration, index: number) => false | void

Returns

false | undefined