summaryrefslogtreecommitdiff
path: root/node_modules/css-tokenize/README.md
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:50:21 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:50:21 +0800
commit0379526e20e1ff212df23e6326741aa9c06df204 (patch)
tree340143b0c4dc4280c88ba1591d137b53477005b3 /node_modules/css-tokenize/README.md
parent7aba14fb7c970c6e6af82c805db2aef6d70bfe2b (diff)
added doiuse plugin for postcss
Diffstat (limited to 'node_modules/css-tokenize/README.md')
-rw-r--r--node_modules/css-tokenize/README.md100
1 files changed, 100 insertions, 0 deletions
diff --git a/node_modules/css-tokenize/README.md b/node_modules/css-tokenize/README.md
new file mode 100644
index 00000000..df92e822
--- /dev/null
+++ b/node_modules/css-tokenize/README.md
@@ -0,0 +1,100 @@
+css-tokenize
+============
+
+Coarsely tokenize a stream of CSS, largely modeled after
+[substack/html-tokenize](/substack/html-tokenize).
+
+```javascript
+var tokenize = require('css-tokenize'),
+through = require('through2');
+
+process.stdin
+.pipe(tokenize())
+.pipe(through.obj(function(token, enc, next) {
+ token[1] = token[1].toString(); // it's a buffer slice
+ console.log('TOKEN', token);
+ next();
+}))
+```
+
+Input:
+```css
+
+div {
+ background: red;
+}
+
+.cls {
+ color: green;
+}
+
+#id {
+ font-size: 10px;
+}
+
+/* comment */
+
+@media screen and (min-width: 1000px) {
+ a {
+ text-decoration: underline;
+ }
+}
+
+a:hover {
+ font-weight: bold;
+}
+
+section
+
+
+{
+ margin: 0;
+ /* comment wthin a rule */
+ padding: 5px;
+}
+
+
+body > * {
+
+}
+```
+
+Output:
+```
+TOKEN [ 'root', '\n' ]
+TOKEN [ 'rule_start', 'div {' ]
+TOKEN [ 'rule', '\n background: red;\n' ]
+TOKEN [ 'rule_end', '}' ]
+TOKEN [ 'root', '\n\n' ]
+TOKEN [ 'rule_start', '.cls {' ]
+TOKEN [ 'rule', '\n color: green;\n' ]
+TOKEN [ 'rule_end', '}' ]
+TOKEN [ 'root', '\n\n' ]
+TOKEN [ 'rule_start', '#id {' ]
+TOKEN [ 'rule', '\n font-size: 10px;\n' ]
+TOKEN [ 'rule_end', '}' ]
+TOKEN [ 'comment', '\n\n/* comment */' ]
+TOKEN [ 'space', '\n\n' ]
+TOKEN [ 'atrule_start', '@media screen and (min-width: 1000px) {' ]
+TOKEN [ 'atrule', '\n ' ]
+TOKEN [ 'rule_start', 'a {' ]
+TOKEN [ 'rule', '\n text-decoration: underline;\n ' ]
+TOKEN [ 'rule_end', '}' ]
+TOKEN [ 'atrule', '\n' ]
+TOKEN [ 'atrule_end', '}' ]
+TOKEN [ 'root', '\n\n' ]
+TOKEN [ 'rule_start', 'a:hover {' ]
+TOKEN [ 'rule', '\n font-weight: bold; \n' ]
+TOKEN [ 'rule_end', '}' ]
+TOKEN [ 'root', '\n\n' ]
+TOKEN [ 'rule_start', 'section \n\n\n{' ]
+TOKEN [ 'rule', '\n margin: 0;\n ' ]
+TOKEN [ 'comment', '/* comment wthin a rule */' ]
+TOKEN [ 'rule', '\n padding: 5px;\n' ]
+TOKEN [ 'rule_end', '}' ]
+TOKEN [ 'root', '\n\n\n' ]
+TOKEN [ 'rule_start', 'body > * {' ]
+TOKEN [ 'rule', '\n \n' ]
+TOKEN [ 'rule_end', '}' ]
+TOKEN [ 'root', '\n' ]
+```