dict2css is a μ-library for constructing cascading style sheets from Python dictionaries. It simplifies the process of programmatically generating CSS by mapping Python dictionary structures to CSS rules. The current version is 0.3.0.post1, with an irregular release cadence, having recent updates in late 2023.
pip install dict2cssVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a CSS structure using a Python dictionary and then convert it into a valid CSS string using the `make_css` function. It covers basic element styling, ID selectors, and nested properties.
Migrate existing calls from `DictionaryToCss().convert(data)` to `make_css(data)` for a more streamlined API.
For advanced CSS features, consider generating them as separate strings, concatenating them, or using a more comprehensive CSS preprocessor or templating engine if dynamic generation is required.
Ensure that all dictionary values correspond to valid CSS property values according to CSS specifications to avoid generating malformed stylesheets.
No dependency data recorded yet.