A tailwind parser written completely in python without js dependency (unofficial)
Project description
pyTailwindCSS
- This is a module written to support generating basic TailwindCss using python only.
- This module was written as a subset of the xtracto library then made into a seperate module to simplify contribution and development.
- You may fork and make a PR to this repo to contribute to the development of this module.
installation
pip install pytailwind
USAGE
from pytailwind import Tailwind
tailwind = Tailwind()
page = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Tailwind CSS Page</title>
</head>
<body class="bg-gray-100 flex items-center justify-center min-h-screen">
<div class="text-center p-8 bg-white rounded shadow-lg">
<h1 class="text-3xl font-bold text-blue-600 mb-4">Hello, Tailwind CSS!</h1>
<p class="text-lg text-gray-700 mb-4">This is a simple example using Tailwind CSS.</p>
<button class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-700">Click Me</button>
</div>
</body>
</html>
"""
tailwind_css_for_page = tailwind.generate(page)
print(tailwind_css_for_page)
# OPTION 1: generate css on the fly (recommended during development)
# OPTIONA 2: Save the css to a file (recommended for production environments)
with open("page.css", "wt") as f:
f.write(tailwind_css_for_page)
Features
- Supports most tailwind classes
- Supports Hover, Focus, and Other States refer tailwind guidelines.
- Most of existing tailwind classes can always be parsed using this library (some clases may be missed out please contact shashstormer or make a PR to this repo).
Features to implement
- Config and extension of the default classes with .py config file.
- Watch files and generate css file.
- Add support for human-readable output and minified output (through config or/and CLI Options).
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 pytailwind-0.0.7.tar.gz.
File metadata
- Download URL: pytailwind-0.0.7.tar.gz
- Upload date:
- Size: 39.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9aa8de3d5bb3e472dfcd8130114cca83ad32de129b2888abc290f93c41b9643
|
|
| MD5 |
92466824da8dd8fa7fa8ce96f4305090
|
|
| BLAKE2b-256 |
e2e3520d673f42b4a99029da622dbf1cbd06960b2bdb0e788c61dd874e70e71a
|
Provenance
The following attestation bundles were made for pytailwind-0.0.7.tar.gz:
Publisher:
publish-on-push.yml on shashstormer/pytailwindcss
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytailwind-0.0.7.tar.gz -
Subject digest:
d9aa8de3d5bb3e472dfcd8130114cca83ad32de129b2888abc290f93c41b9643 - Sigstore transparency entry: 774977927
- Sigstore integration time:
-
Permalink:
shashstormer/pytailwindcss@769ee06649b09c7bd92d43526487737fa3ddef0e -
Branch / Tag:
refs/heads/master - Owner: https://github.com/shashstormer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-on-push.yml@769ee06649b09c7bd92d43526487737fa3ddef0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file pytailwind-0.0.7-py3-none-any.whl.
File metadata
- Download URL: pytailwind-0.0.7-py3-none-any.whl
- Upload date:
- Size: 28.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 |
b0ea3193bf91c4b8168360f1159880f3a8773f48122ecb7ff446a8a38b84160a
|
|
| MD5 |
47b5c01fba76450efc032f787afff6a1
|
|
| BLAKE2b-256 |
6b3d02eb4de1f6508bcfd73d91dabd706411742dd90464d02a6cae00a75c47a2
|
Provenance
The following attestation bundles were made for pytailwind-0.0.7-py3-none-any.whl:
Publisher:
publish-on-push.yml on shashstormer/pytailwindcss
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytailwind-0.0.7-py3-none-any.whl -
Subject digest:
b0ea3193bf91c4b8168360f1159880f3a8773f48122ecb7ff446a8a38b84160a - Sigstore transparency entry: 774977929
- Sigstore integration time:
-
Permalink:
shashstormer/pytailwindcss@769ee06649b09c7bd92d43526487737fa3ddef0e -
Branch / Tag:
refs/heads/master - Owner: https://github.com/shashstormer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-on-push.yml@769ee06649b09c7bd92d43526487737fa3ddef0e -
Trigger Event:
push
-
Statement type: