1.0.0-beta.1 • Published 5 years ago

@rogal/custom-properties-to-json v1.0.0-beta.1

Weekly downloads
2
License
MIT
Repository
-
Last release
5 years ago

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"
  }
]
1.0.0-beta.1

5 years ago

1.0.0-beta.0

5 years ago