class Rule
extends Container
Re-export
import { Rule } from "https://deno.land/x/postcss@8.4.16/lib/postcss.d.ts";
Represents a CSS rule: a selector followed by a declaration block.
Once (root, { Rule }) {
let a = new Rule({ selector: 'a' })
a.append(…)
root.append(a)
}
const root = postcss.parse('a{}')
const rule = root.first
rule.type //=> 'rule'
rule.toString() //=> 'a{}'
Constructors
new
Rule(defaults?: RuleProps)Properties
parent: Container | undefined
The rule’s full selector represented as a string.
const root = postcss.parse('a, b { }')
const rule = root.first
rule.selector //=> 'a, b'
An array containing the rule’s individual selectors. Groups of selectors are split at commas.
const root = postcss.parse('a, b { }')
const rule = root.first
rule.selector //=> 'a, b'
rule.selectors //=> ['a', 'b']
rule.selectors = ['a', 'strong']
rule.selector //=> 'a, strong'
Methods
cloneAfter(overrides?: Partial<RuleProps>): this
cloneBefore(overrides?: Partial<RuleProps>): this