Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

css-scanner

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-scanner

Scanner for css element

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by350%
Maintainers
1
Weekly downloads
 
Created
Source

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;}');

// or use pipe
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) {
  // rule: { selector: [], declaration: [{ property: '', value: ''}] }
  // type: if type exists, it's means this role is in @ rule, otherwise it's only a rule
});

css.on('@media', function(name) {
  // name -> string
  if (name) {
    // open

  } else {
    // close
  }
});

css.on('@keyframes', function(name) {
  // name -> { vendor: '', name: '' }
});

css.on('@import', function(name) {
  
});

css.on('@charset', function(name) {
});

scanner()

Start to scanner

// string
css.scanner();

// pipe
css.on('finish', function() {
  this.scanner();
});

Keywords

FAQs

Package last updated on 12 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc