Tailwind CSS utilities for PJX (cn() class merging)
Project description
pjx-tailwind
Tailwind CSS extension for PJX.
This package provides TailwindExtension, which registers cn() as a Jinja2
global for class-name merging and injects the Tailwind browser build on full
HTML pages. Install it directly, or use pjx[tailwind] or pjx[all].
Installation
pip install pjx-tailwind
# or
pip install pjx[tailwind]
What It Adds
cn() merges class names, filters falsy values, and deduplicates repeated
tokens.
Example
---
computed:
btn_class: cn(
"btn",
is_primary and "btn-primary",
disabled and "opacity-50",
)
---
<button class={btn_class}>Save</button>
Results:
cn("foo", "bar") -> "foo bar"
cn("base", false, "extra") -> "base extra"
cn("a b", "b c") -> "a b c"
Extension
TailwindExtension implements the PJXExtension ABC. It is discovered
automatically via the pjx.extensions entry point when the package is
installed:
[project.entry-points."pjx.extensions"]
tailwind = "pjx_tailwind.extension:TailwindExtension"
You can also register it explicitly:
from pjx import PJXEnvironment
from pjx_tailwind.extension import TailwindExtension
env = PJXEnvironment(
loader=FileSystemLoader("templates"),
extensions=[TailwindExtension()],
)
Browser Asset Injection
On full HTML pages, PJX auto-injects the Tailwind browser build when it
detects common utility classes or text/tailwindcss. To vendor the asset
locally instead of using a CDN:
pjx assets build static/vendor/pjx --provider tailwind
Links
- Repository: https://github.com/oornnery/pjx
- Core package: https://pypi.org/project/pjx/
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pjx_tailwind-0.1.1.tar.gz.
File metadata
- Download URL: pjx_tailwind-0.1.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
442374589b08e96c385f79d021c09ca861a29a5aeeea04edcb5a92ea6326c8cc
|
|
| MD5 |
2ba732314bc4cefcc64b84017b5f7225
|
|
| BLAKE2b-256 |
c340e783371893c57a9c327691d516b656c8455abe9975ef9bb41108d3d2d78c
|
Provenance
The following attestation bundles were made for pjx_tailwind-0.1.1.tar.gz:
Publisher:
release.yml on oornnery/pjx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pjx_tailwind-0.1.1.tar.gz -
Subject digest:
442374589b08e96c385f79d021c09ca861a29a5aeeea04edcb5a92ea6326c8cc - Sigstore transparency entry: 1239424055
- Sigstore integration time:
-
Permalink:
oornnery/pjx@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/oornnery
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pjx_tailwind-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pjx_tailwind-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10a4cd0f6e18c6e66be320ece27de703877425927f1b48229b0842c268100b02
|
|
| MD5 |
ec598893079eb1ee9edde433f5333eee
|
|
| BLAKE2b-256 |
a0e934aa24fcf037900e8c21ae16d6de47fd0f145b2209b192dacdf351456262
|
Provenance
The following attestation bundles were made for pjx_tailwind-0.1.1-py3-none-any.whl:
Publisher:
release.yml on oornnery/pjx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pjx_tailwind-0.1.1-py3-none-any.whl -
Subject digest:
10a4cd0f6e18c6e66be320ece27de703877425927f1b48229b0842c268100b02 - Sigstore transparency entry: 1239424061
- Sigstore integration time:
-
Permalink:
oornnery/pjx@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/oornnery
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Trigger Event:
release
-
Statement type: