css-obj

0.0.1 • Public • Published

css-obj

Parse css to js obj model

It is very simple right now

It requires:

  • no comments
  • one space before {
  • } or one key/value pair in each line
  • strictly {key}: {value};
  • so on ..

Usage

Source:

.hidden {
  display: none;
}
a:hover,
.btn.active {
  display: block;
  color: yellow;
}

Parsing:

var parseCss = require('css-obj')
parseCss(css, function(err, obj){
  console.log(obj)
})

Outputs:

[
  [
    '.hidden', {
      'display': 'none'
    }
  ],
  [
    'a:hover, .btn.active', {
      'display': 'block',
      'color': 'yellow'
    }
  ]
]

Package Sidebar

Install

npm i css-obj

Weekly Downloads

15

Version

0.0.1

License

none

Last publish

Collaborators

  • fritx