to_css

Convert plain javascript objects to CSS for inline styling.

tag license deno doc

Description

This utility intended to be used with the Deno runtime.

The toCss allows plain objects to be inlined in HTML or JSX style tags as strings. The function expects camelcased keys and will convert them to valid CSS hyphen-case.

Usage

import { toCss } from "https://deno.land/x/to_css/mod.ts";
const componentStyles = {
    backgroundColor: 'red',
    height: '20px',
}
toCss(componentStyles);
// => 'background-color: red; height: 20px;'