Skip to main content

Utility to create CSS class strings from a multitude of values without poking around with string templates and lengthy logic.

Project description

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.

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


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

Uploaded Source

Built Distribution

classnames-0.1.0-py2.py3-none-any.whl (3.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file classnames-0.1.0.tar.gz.

File metadata

  • Download URL: classnames-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for classnames-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d69d34ba55ef75e88a42e881c069aed42cb351a28301f99cf539c7d1156906e
MD5 775c572737d9c07484d1a5c5970fb144
BLAKE2b-256 c42150922c532fad8a96c70c88c358aa79daea49cbfcf9c818cf7d2666b75fb7

See more details on using hashes here.

File details

Details for the file classnames-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: classnames-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for classnames-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bc7827b7fbb9b0205e71d1968965b8ab67f3717b0079954a3b033ffe4aea9665
MD5 869c6437d4cfbc655a2a04c86cb4cc5d
BLAKE2b-256 17e37a115f1fc7e5d8c6d85c387df2ccb92e3e45b3530368eed07c31e7908652

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page