Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

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

A Bundler with the web in mind.
Go to Latest
method postcss.Container.prototype.walkAtRules
Re-export
import { postcss } from "https://deno.land/x/bundler@0.6.2/deps.ts";
const { Container } = postcss;

Traverses the container’s descendant nodes, calling callback for each at-rule node.

If you pass a filter, iteration will only happen over at-rules that have matching names.

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

root.walkAtRules(rule => {
  if (isOld(rule.name)) rule.remove()
})

let first = false
root.walkAtRules('charset', rule => {
  if (!first) {
    first = true
  } else {
    rule.remove()
  }
})

Parameters

nameFilter: string | RegExp

String or regular expression to filter at-rules by name.

callback: (atRule: AtRule, index: number) => false | void

Iterator receives each node and index.

Returns

false | undefined

Returns false if iteration was broke.

Parameters

callback: (atRule: AtRule, index: number) => false | void

Returns

false | undefined