@tbela99/css-parser
    Preparing search index...

    Function parse

    • parse css

      Parameters

      • stream: string | ReadableStream<string>
      • opt: ParserOptions = {}

        Example:


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

        // css string
        let result = await transform(css);
        console.log(result.code);

        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);
        const result = await parse(readableStream, {beautify: true});

        console.log(result.ast);

        Example using fetch


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

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

        console.log(result.ast);

      Returns Promise<ParseResult>