css-parser

CSS Object Model implementation and CSS parser

Fork from cssom

新增功能点:

  1. 支持重复定义属性
  2. 修复CSS格式化的问题

CSSOM

CSSOM.js is a CSS parser written in pure JavaScript. It also a partial implementation of CSS Object Model.

CSSOM.parse("body {color: black}")
-> {
  cssRules: [
    {
      selectorText: "body",
      style: {
        0: "color",
        color: "black",
        length: 1
      }
    }
  ]
}

Parser demo

To use it with Node.js or any other CommonJS loader:

➤ npm install css-parser