Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Latest commit

 

History

History
83 lines (63 loc) · 1.4 KB

README.md

File metadata and controls

83 lines (63 loc) · 1.4 KB

convert-to-css

Converts an object to (minified) css

NPM

createCssRule(obj, prepend = '')

Create a css rule of an object of objects.

const objectToCss = require('convert-to-css');

const input = {
	'.foo': {
		padding: 10,
	},
	bar: {
		margin: '10em',
	},
};

objectToCss.createCssRule(input);
// result: ".foo{padding:10px}bar{margin:10em}"

objectToCss.createCssRule({foo:{}});
// result: ""

createCssClasses(obj)

Create a css class of an object of objects.

const objectToCss = require('convert-to-css');

const input = {
	foo: {
		padding: 10,
	},
	bar: {
		margin: '10em',
	},
};

objectToCss.createCssClasses(input);
// result: ".foo{padding:10px}.bar{margin:10em}"

createCssIdentifiers(obj)

Create a css identifiers of an object of objects.

const objectToCss = require('convert-to-css');

const input = {
	foo: {
		padding: 10,
	},
	bar: {
		margin: '10em',
	},
};

objectToCss.createCssIdentifiers(input);
// result: "#foo{padding:10px}#bar{margin:10em}"

createCssProperties(obj)

Create a css rule properties of an object.

const objectToCss = require('convert-to-css');

const input = {
	padding: 10,
	margin: '10em',
};

objectToCss.createCssProperties(input);
// result: "padding:10px;margin:10em"

License

MIT © LSVH