Search


Search something to see results

parse

Parse css

Error file not found

Example:


import {parse} from '@tbela99/css-parser';

// css string
let result = await parse(css);
console.log(result.ast);

Example using stream


import {parse} from '@tbela99/css-parser';
import {Readable} from "node:stream";

// usage: node index.ts < styles.css or cat styles.css | node index.ts

const readableStream = Readable.toWeb(process.stdin);
let result = await parse(readableStream, {beautify: true});

console.log(result.ast);

Example using fetch and readable stream


import {parse} from '@tbela99/css-parser';

const response = await fetch('https://docs.deno.com/styles.css');
const result = await parse(response.body, {beautify: true});

console.log(result.ast);

Parameters

  • stream: string | ReadableStream<Uint8Array<ArrayBufferLike>>
  • Optionaloptions: ParserOptions

Returns Promise<ParseResult>

Parameters

Returns Promise<ParseResult>

Parameters

Returns Promise<ParseResult>