Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/bundler/deps.ts>postcss.Container#walkDecls

A Bundler with the web in mind.
Go to Latest
method postcss.Container.prototype.walkDecls
Re-export
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 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