pytailwind


Namepytailwind JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/shashstormer/pytailwindcss
SummaryA tailwind parser written completely in python without js dependency (unofficial)
upload_time2024-06-24 13:48:16
maintainerNone
docs_urlNone
authorshashstormer
requires_pythonNone
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyTailwindCSS

* This is a module written to support generating basic TailwindCss using python only.
* This module was written as a subset of the [xtracto](https://github.com/shashstormer/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

```bash
pip install pytailwind
```

# USAGE 

```py
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](https://tailwindcss.com/)
* Supports Hover, Focus, and Other States refer [tailwind guidelines](https://tailwindcss.com/docs/hover-focus-and-other-states).
* 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).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/shashstormer/pytailwindcss",
    "name": "pytailwind",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "shashstormer",
    "author_email": "shashanka5398@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f5/c0/d976477e11603e84daba909e9fac0d8f574fbaa843732a8010700d236343/pytailwind-0.0.3.tar.gz",
    "platform": null,
    "description": "# pyTailwindCSS\r\n\r\n* This is a module written to support generating basic TailwindCss using python only.\r\n* This module was written as a subset of the [xtracto](https://github.com/shashstormer/xtracto) library then made into a seperate module to simplify contribution and development.\r\n* You may fork and make a PR to [this repo]() to contribute to the development of this module.\r\n\r\n\r\n# installation\r\n\r\n```bash\r\npip install pytailwind\r\n```\r\n\r\n# USAGE \r\n\r\n```py\r\nfrom pytailwind import Tailwind\r\ntailwind = Tailwind()\r\npage = \"\"\"\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n  <meta charset=\"UTF-8\">\r\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n  <title>Simple Tailwind CSS Page</title>\r\n</head>\r\n<body class=\"bg-gray-100 flex items-center justify-center min-h-screen\">\r\n  <div class=\"text-center p-8 bg-white rounded shadow-lg\">\r\n    <h1 class=\"text-3xl font-bold text-blue-600 mb-4\">Hello, Tailwind CSS!</h1>\r\n    <p class=\"text-lg text-gray-700 mb-4\">This is a simple example using Tailwind CSS.</p>\r\n    <button class=\"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-700\">Click Me</button>\r\n  </div>\r\n</body>\r\n</html>\r\n\r\n\"\"\"\r\ntailwind_css_for_page = tailwind.generate(page)\r\nprint(tailwind_css_for_page)\r\n\r\n# OPTION 1: generate css on the fly (recommended during development)\r\n# OPTIONA 2: Save the css to a file (recommended for production environments)\r\nwith open(\"page.css\", \"wt\") as f:\r\n    f.write(tailwind_css_for_page)\r\n```\r\n\r\n# Features\r\n\r\n* Supports most [tailwind classes](https://tailwindcss.com/)\r\n* Supports Hover, Focus, and Other States refer [tailwind guidelines](https://tailwindcss.com/docs/hover-focus-and-other-states).\r\n* 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).\r\n\r\n# Features to implement\r\n1. Config and extension of the default classes with .py config file.\r\n2. Watch files and generate css file.\r\n3. Add support for human-readable output and minified output (through config or/and CLI Options).\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A tailwind parser written completely in python without js dependency (unofficial)",
    "version": "0.0.3",
    "project_urls": {
        "GitHub": "https://github.com/shashstormer/pytailwindcss",
        "Homepage": "https://github.com/shashstormer/pytailwindcss"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1121a06fb63360a31c8fb7870423d68c1a7f1004ad63926431fd8213ec2d5132",
                "md5": "87cc40ee91f62557855db191a10752de",
                "sha256": "8b1a505a7159935ee2ebb9c48900013755f8b4ef98d9b4da21fd0a513a8f6589"
            },
            "downloads": -1,
            "filename": "pytailwind-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "87cc40ee91f62557855db191a10752de",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 18320,
            "upload_time": "2024-06-24T13:48:15",
            "upload_time_iso_8601": "2024-06-24T13:48:15.365682Z",
            "url": "https://files.pythonhosted.org/packages/11/21/a06fb63360a31c8fb7870423d68c1a7f1004ad63926431fd8213ec2d5132/pytailwind-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f5c0d976477e11603e84daba909e9fac0d8f574fbaa843732a8010700d236343",
                "md5": "83cdf371b33bc2edd31232b659c2d92e",
                "sha256": "a0c05fd6e661b0194fa25afec172715f4eae5f6699a8625933d5c777e25306d8"
            },
            "downloads": -1,
            "filename": "pytailwind-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "83cdf371b33bc2edd31232b659c2d92e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 19180,
            "upload_time": "2024-06-24T13:48:16",
            "upload_time_iso_8601": "2024-06-24T13:48:16.620972Z",
            "url": "https://files.pythonhosted.org/packages/f5/c0/d976477e11603e84daba909e9fac0d8f574fbaa843732a8010700d236343/pytailwind-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-24 13:48:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shashstormer",
    "github_project": "pytailwindcss",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pytailwind"
}
        
Elapsed time: 0.26575s