to_css
Deno Module to convert plain javascript objects to CSS for inline styling.
Full 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. Many values such as backgroundClip
and textFillColor
will be vendor-prefixed automatically for greater browser support.
Usage
Basic 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;'
Deno Fresh:
Using- Add:
"to-css": "https://deno.land/x/to_css/mod.ts"
toimport_map.json
. - Import from namespace in map:
import { toCss } from "to-css";
. - Use on preact style tags:
style={toCss({ ... })}
.