# json-to-css-variables

> converts json object into css variables

Latest version **1.0.0** (published 2018-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install json-to-css-variables
pnpm add json-to-css-variables
yarn add json-to-css-variables
bun add json-to-css-variables
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-05-25 |
| First published | 2018-05-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 116.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | tcarlsen |
| Maintainers | tcarlsen |

## Links

- npm: https://www.npmjs.com/package/json-to-css-variables
- Repository: https://github.com/tcarlsen/json-to-css-variables
- Homepage: https://github.com/tcarlsen/json-to-css-variables#readme
- Issues: https://github.com/tcarlsen/json-to-css-variables/issues
- npm.io page: https://npm.io/package/json-to-css-variables

## Recent versions

- 1.0.0 (latest) — 2018-05-25

## README

# JSON to CSS Variables

![image](./image.png)

I had a project where I needed to use a REST API to store CSS settings and fetching them in my frontend, so I came up with this idea to convert a JSON object into CCS Variables and thought I would share the code.

## Installation

```bash
yarn add json-to-css-variables
```

## Usage

```javascript
  const options = {
    element: '.container',
    pretty: true
  }

  const cssString = jsonToCssVariables(json, options)
```

## Options

| Option   | Default | What it does                                     |
| -------- | ------- | ------------------------------------------------ |
| offset   | 0       | Use this to skip properties in the JSON object   |
| element  | ':host' | Where to apply the CSS variables                 |
| pretty   | false   | Should the output be prettified                  |
| unit     | 'px'    | If value is a number what unit should be applied |

## License

[MIT](LICENSE) © tcarlsen

---
_Source: https://npm.io/package/json-to-css-variables · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
