Skip to content

Commit 5125bf1

Browse files
committed
generate documentation #100
1 parent 04525dd commit 5125bf1

File tree

101 files changed

+57041
-2461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+57041
-2461
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/test/ export-ignore
22
/docs/ export-ignore
3+
/typedoc.json export-ignore
4+
/docs/ export-ignore
5+
/.typedoc-tsconfig.jsonc export-ignore
36
/.editorconfig export-ignore
47
/build.sh export-ignore linguist-vendored
58
/Writerside export-ignore linguist-vendored

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
/.idea
55
/.DS_Store
66
/ROADMAP.md
7-
/docs
87
/package-lock.json
98
test/*.ts
109
test/*.js

.npmignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@
1919
/validator
2020
/sw.js
2121
/jsr.json
22-
/.editorconfig
22+
/.editorconfig
23+
/typedoc-tsconfig.jsonc
24+
/typedoc.json
25+
/docs

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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';
146148
const {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

151168
Include 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

Comments
 (0)