Skip to content

Commit db23dd7

Browse files
committed
update docs #112
1 parent 2d97de8 commit db23dd7

File tree

247 files changed

+10684
-11627
lines changed

Some content is hidden

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

247 files changed

+10684
-11627
lines changed

README.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ result
764764
# Node Walker
765765

766766
```javascript
767+
767768
import {walk} from '@tbela99/css-parser';
768769

769770
for (const {node, parent, root} of walk(ast)) {
@@ -923,7 +924,8 @@ const css = `
923924
}
924925
`;
925926

926-
console.debug(await transform(css, options));
927+
const result = await transform(css, options);
928+
console.debug(result.code);
927929

928930
// .foo{transform:scale(calc(40/3))}
929931
```
@@ -934,9 +936,7 @@ the visitor is called only on 'height' declarations
934936

935937
```typescript
936938

937-
import {AstDeclaration, LengthToken, ParserOptions} from "../src/@types";
938-
import {EnumToken} from "../src/lib";
939-
import {transform} from "../src/node";
939+
import {AstDeclaration, EnumToken, LengthToken, ParserOptions, transform} from '@tbela99/css-parser';
940940

941941
const options: ParserOptions = {
942942

@@ -978,7 +978,8 @@ color: lch(from peru calc(l * 0.8) calc(c * 0.7) calc(h + 180))
978978
}
979979
`;
980980

981-
console.debug(await transform(css, options));
981+
const result = await transform(css, options);
982+
console.debug(result.code);
982983

983984
// .foo{height:calc(40px/3);width:3px}.selector{color:#0880b0}
984985

@@ -1019,7 +1020,8 @@ const css = `
10191020
}
10201021
`;
10211022

1022-
console.debug(await transform(css, options));
1023+
const result = await transform(css, options);
1024+
console.debug(result.code);
10231025

10241026
// .foo{height:calc(40px/3)}
10251027

@@ -1060,7 +1062,8 @@ const css = `
10601062
}
10611063
`;
10621064

1063-
console.debug(await transform(css, options));
1065+
const result = await transform(css, options);
1066+
console.debug(result.code);
10641067

10651068
// .foo{height:calc(40px/3)}
10661069

@@ -1079,10 +1082,10 @@ const options: ParserOptions = {
10791082

10801083
visitor: {
10811084

1082-
10831085
Rule(node: AstRule): AstRule {
10841086

1085-
return {...node, sel: '.foo,.bar,.fubar'};
1087+
node.sel = '.foo,.bar,.fubar'
1088+
return node;
10861089
}
10871090
}
10881091
};
@@ -1095,7 +1098,8 @@ const css = `
10951098
}
10961099
`;
10971100

1098-
console.debug(await transform(css, options));
1101+
const result = await transform(css, options);
1102+
console.debug(result.code);
10991103

11001104
// .foo,.bar,.fubar{height:calc(40px/3)}
11011105

@@ -1107,9 +1111,7 @@ Adding declarations to any rule
11071111

11081112
```typescript
11091113

1110-
import {transform} from "../src/node";
1111-
import {AstRule, ParserOptions} from "../src/@types";
1112-
import {parseDeclarations} from "../src/lib";
1114+
import {AstRule, parseDeclarations, ParserOptions, transform} from '@tbela99/css-parser';
11131115

11141116
const options: ParserOptions = {
11151117

@@ -1135,7 +1137,8 @@ const css = `
11351137
}
11361138
`;
11371139

1138-
console.debug(await transform(css, options));
1140+
const result = await transform(css, options);
1141+
console.debug(result.code);
11391142

11401143
// .foo{width:3px}
11411144

0 commit comments

Comments
 (0)