# css-to-style

> Transform a string of css rules into a style object

Latest version **1.4.0** (published 2020-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install css-to-style
pnpm add css-to-style
yarn add css-to-style
bun add css-to-style
```

## Health

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

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2020-11-08 |
| First published | 2017-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/css-to-style) |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Jacob Buck |
| Maintainers | jacobbuck |
| Keywords | css, object, parse, react, string, style |

## Links

- npm: https://www.npmjs.com/package/css-to-style
- Repository: https://github.com/jacobbuck/css-to-style
- Issues: https://github.com/jacobbuck/css-to-style/issues
- npm.io page: https://npm.io/package/css-to-style

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 1.4.0 (latest) — 2020-11-08
- 1.3.3 — 2020-06-27
- 1.3.2 — 2020-06-27
- 1.3.1 — 2020-06-09
- 1.3.0 — 2019-06-22
- 1.2.1 — 2018-10-19
- 1.2.0 — 2017-09-07
- 1.1.0 — 2017-09-07
- 1.0.3 — 2017-04-27
- 1.0.2 — 2017-04-25
- 1.0.1 — 2017-04-24
- 1.0.0 — 2017-04-24

## README

# css-to-style

Transform a string of css rules into a style object.

## Usage

```js
toStyle(cssText);
```

### Parameters

- `cssText` string of CSS rules

### Return value

An object of CSS rules, where the properties are camelCased.

## Example

```js
import toStyle from 'css-to-style';

toStyle('font-size: 2em; color: #f00; margin-top: 4px');
// returns { fontSize: '2em', color: '#f00', marginTop: '4px' }
```

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