# css-to-js-nodejs

> CSS in JS for NodeJS API's

Latest version **1.0.1** (published 2021-05-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install css-to-js-nodejs
pnpm add css-to-js-nodejs
yarn add css-to-js-nodejs
bun add css-to-js-nodejs
```

## 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 | 2021-05-13 |
| First published | 2021-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Even Stensberg |
| Maintainers | ev1stensberg |
| Keywords | css, js, css-in-js, css-in-js-nodejs |

## Links

- npm: https://www.npmjs.com/package/css-to-js-nodejs
- npm.io page: https://npm.io/package/css-to-js-nodejs

## Dependencies (1)

- [css](https://npm.io/package/css.md) ^3.0.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-05-13
- 1.0.0 — 2021-05-11

## README

## CSS-in-JS-NodeJS

## Installation

```console
npm install --save css-in-js-nodejs
```

## Example


### Given an example css file (test.css)

```css
.main-wrapper {
    flex-direction: row;
    display: flex;
    flex: 1;
  }
  #content {
    flex: 1;
  }
  ul {
    padding: 20px 0;
    flex: 1;
  }
  li {
    font-family:'Lato';
    color: whitesmoke;
    line-height: 44px;
  }

  @media screen and (max-width: 992px) {
    body {
      background-color: blue;
    }
  }

html {
    font-family: Gill Sans Extrabold, sans-serif;
    mask-image: url("masks.svg#mask1");
}
```


### test.js

```js
import fs from 'fs';
import cssToJS from 'css-to-js-nodejs';

const input = fs.readFileSync('./test.css', 'utf8');

const output = main(input);
console.log(output)
/*

{
  '.main-wrapper': { flexDirection: 'row', display: 'flex', flex: '1' },
  '#content': { flex: '1' },
  ul: { padding: '20px 0', flex: '1' },
  li: { fontFamily: "'Lato'", color: 'whitesmoke', lineHeight: '44px' },
  'screen and (max-width: 992px)': { body: { backgroundColor: 'blue' } },
  html: {
    fontFamily: 'Gill Sans Extrabold, sans-serif',
    maskImage: 'url("masks.svg#mask1")'
  }
}

*/
```

## Need help or want to donate to help me make Open Source projects?

- Send me a message on [Twitter](https://twitter.com/evenstensberg)!
- [Donate](https://github.com/sponsors/evenstensberg)

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