Skip to main content
Module

x/bundler/deps.ts>postcss.Postcss

A Bundler with the web in mind.
Latest
interface postcss.Postcss
import { type postcss } from "https://deno.land/x/bundler@0.9.0/deps.ts";
const { Postcss } = postcss;

Call Signatures

(plugins?: AcceptedPlugin[]): Processor

Create a new Processor instance that will apply plugins as CSS processors.

let postcss = require('postcss')

postcss(plugins).process(css, { from, to }).then(result => {
  console.log(result.css)
})
(...plugins: AcceptedPlugin[]): Processor

Properties

stringify: Stringifier

Default function to convert a node tree into a CSS string.

parse: Parser<Root>

Parses source css and returns a new Root or Document node, which contains the source CSS nodes.

// Simple CSS concatenation with source map support
const root1 = postcss.parse(css1, { from: file1 })
const root2 = postcss.parse(css2, { from: file2 })
root1.append(root2).toResult().css
fromJSON: JSONHydrator

Rehydrate a JSON AST (from Node#toJSON) back into the AST classes.

const json = root.toJSON()
// save to file, send by network, etc
const root2  = postcss.fromJSON(json)
list: List

Contains the list module.

CssSyntaxError: CssSyntaxError
Declaration: Declaration
Container: Container
Comment: Comment
Warning: Warning
AtRule: AtRule
Result: Result
Input: Input
Rule: Rule
Root: Root
Node: Node

Methods

comment(defaults?: CommentProps): Comment

Creates a new Comment node.

atRule(defaults?: AtRuleProps): AtRule

Creates a new AtRule node.

decl(defaults?: DeclarationProps): Declaration

Creates a new Declaration node.

rule(defaults?: RuleProps): Rule

Creates a new Rule node.

root(defaults?: RootProps): Root

Creates a new Root node.

document(defaults?: DocumentProps): Document

Creates a new Document node.