Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

to-style-ts

alexanderl1918MIT1.0.1TypeScript support: included

Convert react-like style objects to css style strings.

css, css object, object, object-to-style, react css, react css object, style, style-to-object

readme

to-style-ts

Convert react-like css objects to style strings. This package is not a drop in replacement for to-style, as nested styles are not supported.

Property names are expected to be camelCase. Properties with vendor prefixes should be UpperCamelCase / PascalCase, with the exception of ms.

Usage

to-style-ts has one named export: toStyleString.

import { toStyleString } from "to-style-ts";

toStyleString({
  width: "10px",
  height: 10,
  margin: "1em",
  msFlexPositive: 2,
  MozBoxFlex: 2,
});
// width:10px;height:10px;margin:1em;-ms-flex-positive:2;-moz-box-flex:2;

Contributing

To install bun:

https://bun.sh/docs/installation

To install dependencies:

bun install

To build:

bun run build

License

Copyright © 2023 Alexander Liu

MIT License