aboutsummaryrefslogtreecommitdiff
path: root/node_modules/css-parse/Readme.md
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/css-parse/Readme.md
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/css-parse/Readme.md')
-rw-r--r--node_modules/css-parse/Readme.md142
1 files changed, 142 insertions, 0 deletions
diff --git a/node_modules/css-parse/Readme.md b/node_modules/css-parse/Readme.md
new file mode 100644
index 00000000..0f6169ef
--- /dev/null
+++ b/node_modules/css-parse/Readme.md
@@ -0,0 +1,142 @@
+# css-parse [![Build Status](https://travis-ci.org/visionmedia/css-parse.png)](https://travis-ci.org/visionmedia/css-parse)
+
+ JavaScript CSS parser for nodejs and the browser.
+
+## Installation
+
+ $ npm install css-parse
+
+## Usage
+
+````javascript
+var parse = require('css-parse');
+
+// CSS input string
+var css = "body { \n background-color: #fff;\n }";
+
+var output_obj = parse(css);
+
+// Position and Source parameters
+var output_obj_pos = parse(css, { position: true, source: 'file.css' });
+
+// Print parsed object as CSS string
+console.log(JSON.stringify(output_obj, null, 2));
+
+````
+
+## Example
+
+css:
+
+```css
+body {
+ background: #eee;
+ color: #888;
+}
+```
+
+parse tree:
+
+```json
+{
+ "type": "stylesheet",
+ "stylesheet": {
+ "rules": [
+ {
+ "type": "rule",
+ "selectors": [
+ "body"
+ ],
+ "declarations": [
+ {
+ "type": "declaration",
+ "property": "background",
+ "value": "#eee"
+ },
+ {
+ "type": "declaration",
+ "property": "color",
+ "value": "#888"
+ }
+ ]
+ }
+ ]
+ }
+}
+```
+
+parse tree with `.position` enabled:
+
+```json
+{
+ "type": "stylesheet",
+ "stylesheet": {
+ "rules": [
+ {
+ "type": "rule",
+ "selectors": [
+ "body"
+ ],
+ "declarations": [
+ {
+ "type": "declaration",
+ "property": "background",
+ "value": "#eee",
+ "position": {
+ "start": {
+ "line": 3,
+ "column": 3
+ },
+ "end": {
+ "line": 3,
+ "column": 19
+ }
+ }
+ },
+ {
+ "type": "declaration",
+ "property": "color",
+ "value": "#888",
+ "position": {
+ "start": {
+ "line": 4,
+ "column": 3
+ },
+ "end": {
+ "line": 4,
+ "column": 14
+ }
+ }
+ }
+ ],
+ "position": {
+ "start": {
+ "line": 2,
+ "column": 1
+ },
+ "end": {
+ "line": 5,
+ "column": 2
+ }
+ }
+ }
+ ]
+ }
+}
+```
+
+If you also pass in `source: 'path/to/original.css'`, that will be set
+on `node.position.source`.
+
+## Performance
+
+ Parsed 15,000 lines of CSS (2mb) in 40ms on my macbook air.
+
+## Related
+
+ [css-stringify](https://github.com/visionmedia/css-stringify "CSS-Stringify")
+ [css-value](https://github.com/visionmedia/css-value "CSS-Value")
+
+## License
+
+ MIT