import { type Postcss } from "https://deno.land/x/postcss@8.4.16/lib/postcss.d.ts";
Call Signatures
(plugins?: AcceptedPlugin[]): Processor
Create a new Processor
instance that will apply plugins
as CSS processors.
import { postcss } from "./deps.js"
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.
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.
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.
document(defaults?: DocumentProps): Document
Creates a new Document
node.