# jsoncss

> Convert json to css

Latest version **1.0.2** (published 2015-12-16) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install jsoncss
pnpm add jsoncss
yarn add jsoncss
bun add jsoncss
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2015-12-16 |
| First published | 2015-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Leonard Schuetz |
| Maintainers | kcreate |

## Links

- npm: https://www.npmjs.com/package/jsoncss
- Repository: https://github.com/KCreate/jsoncss
- Homepage: https://github.com/KCreate/jsoncss#readme
- Issues: https://github.com/KCreate/jsoncss/issues
- npm.io page: https://npm.io/package/jsoncss

## Recent versions

- 1.0.2 (latest) — 2015-12-16
- 1.0.1 — 2015-12-13
- 1.0.0 — 2015-12-12

## README

# jsoncss
npm module that converts json to css.

# Why?
You could combine this with your build process so your server only sends down the needed css to the client. This reduces data usage enormously. For example, Facebook sends down so much css and only uses 10% of it. They could shave off 90% of their css and nobody would notice.

# Usage
```javascript
var jsoncss = require('jsoncss');
```
## Object to css
```javascript
// test object to css
jsoncss.convert({
	"body": {
		"color":"red"
	}
}, '', function(err, result) {
	if (err) {
		return console.log(err);
	}
	console.log(result);
});
```
## JSON string
```javascript
// test json to css
jsoncss.convert('{"body":{"color":"blue"}}', '', function(err, result) {
	if (err) {
		return console.log(err);
	}
	console.log(result);
});
```
## File
```javascript
// test json-file to css
var fs			= require('fs');
fs.readFile('style.json', 'utf8', function(err,data) {
	if (err) {
		return console.log(err);
	}
	var conversion = jsoncss.convert(data, '', function(err, result){
		if (err) {
			return console.log(err);
		}
		console.log(result);
	});
});
```

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