@@ -16,8 +16,8 @@ var css = "body { \n background-color: #fff;\n }";
1616
1717var output_obj = parse (css);
1818
19- // Filename parameter for source mapping
20- var output_obj_pos = parse (css, { filename : ' file.css' });
19+ // Source parameter to specify source file name for source maps
20+ var output_obj_pos = parse (css, { source : ' file.css' });
2121
2222// Print parsed object as CSS string
2323console .log (JSON .stringify (output_obj, null , 2 ));
@@ -30,7 +30,7 @@ console.log(JSON.stringify(output_obj, null, 2));
3030
3131` options ` :
3232
33- - ` filename ` - recommended for debugging.
33+ - ` source ` - recommended for debugging.
3434- ` position ` - ` true ` by default.
3535
3636### Errors
@@ -39,8 +39,7 @@ Errors will have `err.position` where `position` is:
3939
4040- ` start ` - start line and column numbers
4141- ` end ` - end line and column numbers
42- - ` filename ` - filename if passed to options
43- - ` source ` - source CSS string
42+ - ` source ` - ` options.source ` if passed to options
4443
4544If you create any errors in plugins such as in [ rework] ( https://github.com/reworkcss/rework ) , you __ must__ set the ` position ` as well for consistency.
4645
@@ -145,17 +144,18 @@ parse tree with `.position` enabled:
145144}
146145```
147146
148- If you also pass in ` filename: 'path/to/original.css' ` , that will be set
149- on ` node.position.filename ` .
147+ ` node.position.content ` is set on each node to the full source string. If you
148+ also pass in ` source: 'path/to/original.css' ` , that will be set on
149+ ` node.position.source ` .
150150
151151## Performance
152152
153153 Parsed 15,000 lines of CSS (2mb) in 40ms on my macbook air.
154154
155155## Related
156-
157- [ css-stringify] ( https://github.com/visionmedia/css-stringify " CSS-Stringify ")
158- [ css-value] ( https://github.com/visionmedia/css-value " CSS-Value ")
156+
157+ [ css-stringify] ( https://github.com/visionmedia/css-stringify " CSS-Stringify ")
158+ [ css-value] ( https://github.com/visionmedia/css-value " CSS-Value ")
159159
160160## License
161161
0 commit comments