lucafaggianelli / python-classnames

Utility to generate CSS class strings from a multitude of inputs without headaches

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python classnames

pypi python Build Status codecov

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
    })

Features

  • TODO

Credits

This package was created with Cookiecutter and the waynerv/cookiecutter-pypackage project template.

About

Utility to generate CSS class strings from a multitude of inputs without headaches

License:MIT License


Languages

Language:Python 67.9%Language:Makefile 32.1%