Search


Search something to see results

render

Render the ast tree

Parameters

  • data: any
  • options: RenderOptions = {}
  • Optionalmapping: 
        | {
            importMapping: Record<string, Record<string, string>>
            | null;
            mapping: Record<string, string>;
        }
        | null

    Example:


    import {render, ColorType} from '@tbela99/css-parser';

    const css = 'body { color: color(from hsl(0 100% 50%) xyz x y z); }';
    const parseResult = await parse(css);

    let renderResult = render(parseResult.ast);
    console.log(result.code);

    // body{color:red}


    renderResult = render(parseResult.ast, {beautify: true, convertColor: ColorType.SRGB});
    console.log(renderResult.code);

    // body {
    // color: color(srgb 1 0 0)
    // }

Returns RenderResult