render
render(
data: any,
options?: RenderOptions,
mapping?:
| {
importMapping: Record<string, Record<string, string>>
| null;
mapping: Record<string, string>;
}
| null,
): RenderResult
Parameters
data: anyoptions: RenderOptions = {}Optionalmapping:
| {
importMapping: Record<string, Record<string, string>>
| null;
mapping: Record<string, string>;
}
| nullExample:
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)
// }
Render the ast tree