Skip to main content
Module

x/bundler/deps.ts>postcss.Document

A Bundler with the web in mind.
Latest
class postcss.Document
extends Container<Root>
Re-export
import { postcss } from "https://deno.land/x/bundler@0.9.0/deps.ts";
const { Document } = postcss;

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 })