Skip to main content
Deno 2 is finally here 🎉️
Learn more
Latest
class Document
extends Container<Root>
Re-export
import { Document } from "https://deno.land/x/postcss@8.4.16/lib/postcss.js";

Represents a file and contains all its parsed nodes.

Experimental: some aspects of this node could change within minor or patch version releases.

const document = htmlParser(
  '<html><style>a{color:black}</style><style>b{z-index:2}</style>'
)
document.type         //=> 'document'
document.nodes.length //=> 2

Constructors

new
Document(defaults?: DocumentProps)

Properties

parent: undefined
type: "document"

Methods

Returns a Result instance representing the document’s CSS roots.

const root1 = postcss.parse(css1, { from: 'a.css' })
const root2 = postcss.parse(css2, { from: 'b.css' })
const document = postcss.document()
document.append(root1)
document.append(root2)
const result = document.toResult({ to: 'all.css', map: true })