@@ -134,7 +134,9 @@ Parse and render css in a single pass.
134134
135135``` typescript
136136
137- transform (css , transformOptions : TransformOptions = {}): TransformResult
137+ transform (css : string | ReadableStream < string > , transformOptions : TransformOptions = {}): TransformResult
138+ parse (css : string | ReadableStream < string > , parseOptions : ParseOptions = {}): ParseResult ;
139+ render (ast : AstNode , renderOptions : RenderOptions = {}): RenderResult ;
138140```
139141
140142### Example
@@ -146,6 +148,21 @@ import {transform} from '@tbela99/css-parser';
146148const {ast , code , map , errors , stats } = await transform (css, {minify: true , resolveImport: true , cwd: ' files/css' });
147149```
148150
151+ ### Example
152+
153+ Read from stdin with node using readable stream
154+
155+ ``` typescript
156+ import {transform } from " ../src/node" ;
157+ import {Readable } from " node:stream" ;
158+ import type {TransformResult } from ' ../src/@types/index.d.ts' ;
159+
160+ const readableStream: ReadableStream <string > = Readable .toWeb (process .stdin ) as ReadableStream <string >;
161+ const result: TransformResult = await transform (readableStream , {beautify: true });
162+
163+ console .log (result .code );
164+ ```
165+
149166### TransformOptions
150167
151168Include ParseOptions and RenderOptions
@@ -215,17 +232,17 @@ Include ParseOptions and RenderOptions
215232 - true: same as ColorType.HEX
216233 - false: no color conversion
217234 - ColorType.HEX
218- - ColorType.RGB/ ColorType.RGBA
235+ - ColorType.RGB or ColorType.RGBA
219236 - ColorType.HSL
220237 - ColorType.HWB
221- - ColorType.CMYK/ ColorType.DEVICE_CMYK
238+ - ColorType.CMYK or ColorType.DEVICE_CMYK
222239 - ColorType.SRGB
223240 - ColorType.SRGB_LINEAR
224241 - ColorType.DISPLAY_P3
225242 - ColorType.PROPHOTO_RGB
226243 - ColorType.A98_RGB
227244 - ColorType.REC2020
228- - ColorType.XYZ/ ColorType.XYZ_D65
245+ - ColorType.XYZ or ColorType.XYZ_D65
229246 - ColorType.XYZ_D50
230247 - ColorType.LAB
231248 - ColorType.LCH
0 commit comments