css-scanner
Scanner for css element, refer to w3c css
var CssScanner = require('css-scanner');
install
npm install css-scanner --save
test
mocha
API
CssScanner(str, filepath)
CssScanner is inherit to Writable stream
.
- {string|undefined}
str
The css code string or empty - {string}
filepath
it's useful for see error message.
var css = new CssScanner('a{color:red;}');
var css = new CssScanner();
fs.createReadStream('path/bootstrap.css').pipe(css);
on
inherit the System events module. List emit event name
comment
rule
@meida
if the name is undefined, it's means media close, otherwise media open@keyframes
if the name is undefined, it's means keyframes close, otherwise keyframes open@import
@charset
css.on('comment', function(match) {
});
css.on('rule', function(rule, type) {
});
css.on('@media', function(name) {
if (name) {
} else {
}
});
css.on('@keyframes', function(name) {
});
css.on('@import', function(name) {
});
css.on('@charset', function(name) {
});
scanner()
Start to scanner
css.scanner();
css.on('finish', function() {
this.scanner();
});