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

x/deno_bundler/deps.ts>postcss.AtRule

A Bundler with the web in mind.
Latest
class postcss.AtRule
extends Container
Re-export
import { postcss } from "https://deno.land/x/deno_bundler@v0.9.1/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

name: string

The at-rule’s name immediately follows the @.

const root  = postcss.parse('@media print {}')
media.name //=> 'media'
const media = root.first
params: string

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'
parent: Container | undefined
raws: AtRuleRaws
type: "atrule"

Methods

assign(overrides: object | AtRuleProps): this
clone(overrides?: Partial<AtRuleProps>): this
cloneAfter(overrides?: Partial<AtRuleProps>): this
cloneBefore(overrides?: Partial<AtRuleProps>): this