npm install demitasse
cssBindings:
(css: string) => {
classes: Record<ClassRef extends string, string>;
ids: Record<IdRef extends string, string>;
}
Given a style sheet, returns a map of class names and IDs. For use with dot notation, keys are converted to camel-case; e.g. button-label
is converted to buttonLabel
. The values correspond to the names that appear in the css
.
makeCSSBindings:
<Context>(mapFn: (name: string, meta: { type: "class" | "id", context: Context }) => string) =>
(css: string, context: Context) => {
classes: Record<ClassRef extends string, string>;
ids: Record<IdRef extends string, string>;
}
Given a mapping function mapFn
, returns a function similar to cssBindings
, except with one additional context
parameter. The context
argument is forwarded to mapFn
and can be used e.g. to add a prefix to the class name or ID.
Generated API documentation is available here.