css-rule-stream
transform stream to cut css into rule-sized chunks
Last updated 10 years ago by anandthakker .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install css-rule-stream 
SYNC missed versions from official npm registry.

css-rule-stream Build Status

transform stream to cut css into rule-sized chunks, which come in the form:

{
  content: "your css"
}

Example:

var rules = require('css-rule-stream'),
    ldjson = require('ldjson-stream');

fs.readFileSync(__dirnam + '/main.css')
  .pipe(rules)
  .pipe(ldjson.serialize())
  .pipe(process.stdout);

main.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

{"content":"div {\n  background: red;\n}"}
{"content":".cls {\n  color: green;\n}"}
{"content":"#id {\n  font-size: 10px;\n}"}
{"content":"@media screen and (min-width: 1000px) {\n  a {\n    text-decoration: underline;\n  }\n}"}
{"content":"a:hover {\n  font-weight: bold;  \n}"}
{"content":"section \n\n\n{\n  margin: 0;\n  /* comment wthin a rule */\n  padding: 5px;\n}"}
{"content":"body > * {\n  \n}"}

Current Tags

  • 1.1.0                                ...           latest (10 years ago)

5 Versions

  • 1.1.0                                ...           10 years ago
  • 1.0.3                                ...           10 years ago
  • 1.0.2                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE