Utility to create CSS class strings from a multitude of values without poking around with string templates and lengthy logic.
Project description
Python classnames
Utility to create CSS class strings from a multitude of values without poking around with string templates and lengthy logic.
This project is a Python porting of the JS library classnames
Show me the code!
pip install classnames
from classnames import class_names
# render_button() -> "btn btn--red"
# render_button(rounded=True) -> "btn btn--rounded btn--red"
def render_button(rounded: bool = False, color = "red"):
class_names("btn", f"btn--{color}", {
"btn--rounded": rounded
})
- Documentation: https://lucafaggianelli.github.io/python-classnames
- GitHub: https://github.com/lucafaggianelli/python-classnames
- PyPI: https://pypi.org/project/python-classnames/
Features
- TODO
Credits
This package was created with Cookiecutter and the waynerv/cookiecutter-pypackage project template.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
0.1.0 - 2022-11-04
- initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
classnames-0.1.0.tar.gz
(6.3 kB
view hashes)
Built Distribution
Close
Hashes for classnames-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc7827b7fbb9b0205e71d1968965b8ab67f3717b0079954a3b033ffe4aea9665 |
|
MD5 | 869c6437d4cfbc655a2a04c86cb4cc5d |
|
BLAKE2b-256 | 17e37a115f1fc7e5d8c6d85c387df2ccb92e3e45b3530368eed07c31e7908652 |