Skip to content

Commit b929df7

Browse files
committed
v0.0.1-alpha2
1 parent 47cd0f0 commit b929df7

32 files changed

+5493
-7650
lines changed

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,37 @@ CSS parser for node and the browser
88
$ npm install @tbela99/css-parser
99
```
1010

11+
## Transform
12+
13+
Parse and render css in a single pass.
14+
15+
```javascript
16+
import {transform} from '@tbela99/css-parser';
17+
18+
const {ast, code, errors} = transform(css);
19+
```
20+
21+
### Usage
22+
23+
```javascript
24+
25+
transform(css, transformOptions = {})
26+
```
27+
### TransformOptions
28+
29+
Include both ParseOptions and RenderOptions
30+
31+
- src: string, optional. css file location to be used with sourcemap.
32+
- location: boolean, optional. includes node location in the ast, required for sourcemap generation.
33+
- processImport: boolean, process @import node - not yet implemented
34+
- compress: boolean, default to _true_. optimize ast and minify css.
35+
- removeEmpty: boolean, remove empty nodes from the ast.
36+
- indent: string, optional. css indention string. uses space character by default.
37+
- newLine: string, new line character.
38+
- removeComments: boolean, remove comments in generated css.
39+
- preserveLicense: boolean, force preserving comments starting with '/\*!' when compress is enabling.
40+
41+
1142
## Parsing
1243

1344
```javascript
@@ -22,7 +53,7 @@ const {ast, errors} = parse(css);
2253

2354
parse(css, parseOptions = {})
2455
```
25-
### parseOptions
56+
### ParseOptions
2657

2758
- src: string, optional. css file location
2859
- location: boolean, optional. includes node location in the ast
@@ -46,7 +77,7 @@ const {code} = render(ast, {compress: true});
4677
console.log(code);
4778
```
4879

49-
### Rendering options
80+
### RenderOptions
5081

5182
- compress: boolean, optional. minify output. Also remove comments
5283
- indent: string, optional. indention string. uses space character by default.

0 commit comments

Comments
 (0)