# cssjson-cli

> CLI utility for CSSJSON (https://github.com/aramk/CSSJSON)

Latest version **1.0.1** (published 2016-12-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install cssjson-cli
pnpm add cssjson-cli
yarn add cssjson-cli
bun add cssjson-cli
```

Provides the command `cssjson`.

## 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.1 |
| Published | 2016-12-07 |
| First published | 2016-12-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jake Dexheimer |
| Maintainers | jakedex |
| Keywords | cssjson, csstojson, css2json, jsontocss, json2css, cli |

## Links

- npm: https://www.npmjs.com/package/cssjson-cli
- Repository: https://github.com/jakedex/cssjson-cli
- Homepage: https://github.com/jakedex/cssjson-cli#readme
- Issues: https://github.com/jakedex/cssjson-cli/issues
- npm.io page: https://npm.io/package/cssjson-cli

## Dependencies (3)

- [yargs](https://npm.io/package/yargs.md) ^6.5.0
- [cssjson](https://npm.io/package/cssjson.md) ^2.1.3
- [through2](https://npm.io/package/through2.md) ^2.0.3

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-12-07
- 1.0.0 — 2016-12-07

## README

# cssjson-cli
A CLI utility for [CSSJSON](https://github.com/aramk/CSSJSON). Converts the contents of a CSS file to JSON (or vice-versa).

## Installation
```
$ npm install -g cssjson-cli
```

## Usage
`cssjson` converts css to JSON. To convert JSON to CSS, use the `--to-css` flag.
```
$ cssjson input_file [--to-css] [--output|-o output_file]
```

By default, `cssjson` outputs to `stdout`. You can specify an output file with the `--output` flag:
```
$ cssjson style.css --output style.js
```

It converts a file like this:

```css
.btn {
  background: #bbb;
  padding: 0.5rem;
  font-size: 1rem;
}

.btn-primary {
  background: red;
  color: #fff;
}
```

into one like this:
```json
{
  "children": {
    ".btn": {
      "children": {},
      "attributes": {
        "background": "#bbb",
        "padding": "0.5rem",
        "font-size": "1rem"
      }
    },
    ".btn-primary": {
      "children": {},
      "attributes": {
        "background": "red",
        "color": "#fff"
      }
    }
  },
  "attributes": {}
}
```

## Examples
CSS -> JSON
```
cssjson input.css -o output.json
```
JSON -> CSS
```
cssjson input.js --to-css -o output.css
```

## Options
### to-css
`--to-css`
Convert JSON -> CSS.

### output
`-o, --output [output_file]`
A target file to output the result to. If this flag isn't included, `cssjson` will output to `stdout`.

### help
`-h, --help`
Show help

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