class postcss.AtRule
extends Container
Re-export
import { postcss } from "https://deno.land/x/bundler@0.6.5/deps.ts";
const { AtRule } = postcss;
Represents an at-rule.
Once (root, { AtRule }) {
let media = new AtRule({ name: 'media', params: 'print' })
media.append(…)
root.append(media)
}
If it’s followed in the CSS by a {} block, this node will have a nodes property representing its children.
const root = postcss.parse('@charset "UTF-8"; @media print {}')
const charset = root.first
charset.type //=> 'atrule'
charset.nodes //=> undefined
const media = root.last
media.nodes //=> []
Constructors
new
AtRule(defaults?: AtRuleProps)Properties
The at-rule’s name immediately follows the @
.
const root = postcss.parse('@media print {}')
media.name //=> 'media'
const media = root.first
The at-rule’s parameters, the values that follow the at-rule’s name but precede any {} block.
const root = postcss.parse('@media print, screen {}')
const media = root.first
media.params //=> 'print, screen'
Methods
clone(overrides?: Partial<AtRuleProps>): this
cloneAfter(overrides?: Partial<AtRuleProps>): this
cloneBefore(overrides?: Partial<AtRuleProps>): this