node package manager


CSS Object Model implementation and CSS parser

Fork from cssom


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


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