Skip to main content

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

  1. Config and extension of the default classes with .py config file.
  2. Watch files and generate css file.
  3. Add support for human-readable output and minified output (through config or/and CLI Options).

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

pytailwind-0.0.2.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytailwind-0.0.2-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file pytailwind-0.0.2.tar.gz.

File metadata

  • Download URL: pytailwind-0.0.2.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pytailwind-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7453c5fccaa942e4d5ee260fedd8e37473ace0f26f297f0c8fc882557493a427
MD5 7a8d08a49e5bedf5e6a72d1ed7265fbe
BLAKE2b-256 8400398f9f8efacadbdc4f6af534b0f0dba83a92b220602ef54160f6452cad90

See more details on using hashes here.

File details

Details for the file pytailwind-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pytailwind-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pytailwind-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e1cef12b9b5037977fda2442c237e325ea33d7c038291d3deda2ae88508d58dd
MD5 02b72911da526ebef21f8ec8b1c357d6
BLAKE2b-256 160893bbf89f4812c71570964b6352d6f2330f87a20c780b8fc403779e475c46

See more details on using hashes here.

Supported by

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