JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 318
  • Score
    100M100P100Q105829F
  • License MIT

Parse css to json.

Package Exports

  • css2json

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (css2json) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Css2json

Css2json transform CSS to JSON.

Installation

npm install css2json

Usage

var css2json = require('css2json');
var json = css2json(css);

Example

The css

h1#header {
  font-family: 'Times New Roman';
}

p {
  margin-right: 100px;
}

h1#header {
  color: #ff0000  
}

would transform into

{
  "h1#header": {
    "font-family": "Times New Roman",
    "color": "#ff0000"
  },
  "p": {
    "margin-right": "100px"
  }
}