8000 Merge pull request #113 from tbela99/v.next · tbela99/css-parser@9dd5377 · GitHub
Skip to content
8000

Commit 9dd5377

Browse files
authored
Merge pull request #113 from tbela99/v.next
- [x] make streaming optional #109 - [x] patch at-rule syntax for @font-feature-value #110 - [x] support percentage in transform() and scale() #111 - [x] allow arrays in visitor definition #112
2 parents c549e1e + adab65e commit 9dd5377

File tree

341 files changed

+22942
-16315
lines changed

Some content is hidden

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

341 files changed

+22942
-16315
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## v1.3.4
4+
5+
- [x] make streaming optional #109
6+
- [x] patch at-rule syntax for @font-feature-value #110
7+
- [x] support percentage in transform() and scale() #111
8+
- [x] allow arrays in visitor definition #112
9+
310
## v1.3.3
411

512
- [x] relative color computation bug #105

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# css-parser
66

7-
CSS parser and minifier for node and the browser
7+
CSS parser, minifier and validator for node and the browser
88

99
## Installation
1010

@@ -101,7 +101,7 @@ Javascript module from cdn
101101

102102
<script type="module">
10310 625E 3
104-
import {transform} from 'https://esm.sh/@tbela99/css-parser@1.3.3/web';
104+
import {transform} from 'https://esm.sh/@tbela99/css-parser@1.3.4/web';
105105
106106
const css = `
107107
.s {
@@ -126,7 +126,7 @@ Javascript umd module from cdn
126126

127127
```html
128128

129-
<script src="https://unpkg.com/@tbela99/css-parser@1.3.2/dist/index-umd-web.js"></script>
129+
<script src="https://unpkg.com/@tbela99/css-parser@1.3.4/dist/index-umd-web.js"></script>
130130
<script>
131131
132132
(async () => {
@@ -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" 28CC ;
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)