Skip to content

Function: parseCssDocs()

ts
function parseCssDocs(css, options?): CssDocEntry[];

Defined in: packages/core/src/parse.ts:348

Parse a CSS string into a documentation model. Records are delimited by doc comments carrying a record tag (@component/@name by default; override via ParseOptions.isRecordBoundary); everything from one boundary comment to the next belongs to that record.

Parameters

css

string

The CSS source (a generated stylesheet, with authored doc comments).

options?

ParseOptions = {}

ParseOptions.

Returns

CssDocEntry[]

One CssDocEntry per record, in document order.

Example

ts
import { parseCssDocs } from "@cssdoc/core";

const [badge] = parseCssDocs(badgeCssWithDocComments);
badge.modifiers.map((m) => m.name); // ["-color-danger", "-color-success", …]

Released under the MIT License