@rogal/custom-properties-to-json

1.0.0-beta.1 • Public • Published

custom-properties-to-json

NPM Version NPM DownloadsTravis Coverage Status

Package that parses a css file with a :root pseudoselector with custom properties to a json object

Use Cases

  • Theme modes so you can change your themes based in custom properties in the fly

Installation

$ npm install @rogal/custom-properties-to-json --save-dev

Use

You'll need to create a css file with a :root pseudoselector

:root {
  --primary-bg-color: blue;
  --color: #ffffff;
}

After creating the file create a task or execute the command

custom-properties-to-json input=src/styles/base-theme.css output=src/styles/variables/base-theme.json

This will create a json with the next structure

[
  {
    "property": "--primary-bg-color",
    "value": "blue"
  },
  {
    "property": "--color",
    "value": "#ffffff"
  }
]

Readme

Keywords

none

Package Sidebar

Install

npm i @rogal/custom-properties-to-json

Weekly Downloads

1

Version

1.0.0-beta.1

License

MIT

Unpacked Size

7.13 kB

Total Files

11

Last publish

Collaborators

  • gabrielseco