tailwind-tidy- Tailwind Templates

Tailwind Tidy

A Python tool that brings order to your Tailwind CSS classes by automatically organizing them into a standardized, logical sequence.

TailwindTidy ๐ŸŒช๏ธโœจ

TailwindTidy is a Python utility that brings structure and consistency to your Tailwind CSS classes. Say goodbye to messy, unorganized utility classes and hello to a clean, standardized ordering system.

โœจ Features

  • ๐ŸŽฏ Automatically organizes Tailwind CSS classes into logical categories
  • ๐Ÿ”„ Maintains consistent ordering based on best practices
  • ๐Ÿงน Cleans up messy class strings
  • ๐Ÿš€ Simple and fast processing
  • ๐Ÿ“ฆ Easy to integrate into existing projects
  • ๐Ÿ› ๏ธ Customizable category patterns

๐Ÿš€ Installation

pip install tailwindtidy

๐ŸŽฏ Quick Start

from tailwindtidy import TailwindClassOrganizer

# Create an instance
organizer = TailwindClassOrganizer()

# Your messy Tailwind classes
messy_classes = """
    hover:bg-gray-100 flex text-blue-700 
    justify-center mx-auto p-4 font-bold
"""

# Get organized classes
organized = organizer.organize_classes(messy_classes)
print(organized)

๐ŸŽจ Class Organization

TailwindTidy organizes classes into the following categories:

  1. Layout - flex, grid, container, positioning
  2. Spacing - margins, padding, width, height
  3. Typography - font properties, text alignment
  4. Colors - text colors, background colors
  5. Borders - borders, rounded corners, shadows
  6. Effects - opacity, transforms, animations
  7. Interactivity - hover states, focus states, cursor

๐Ÿ› ๏ธ Customization

You can customize the category patterns by extending the categories dictionary:

organizer = TailwindClassOrganizer()
organizer.categories['custom'] = [
    r'^your-custom-pattern',
    r'^another-pattern'
]

๐Ÿ’ก Use Cases

  • Maintaining consistent class ordering across a team
  • Cleaning up generated Tailwind classes
  • Enforcing style guide conventions
  • Improving code readability
  • Pre-commit hooks for consistent styling

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ™ Acknowledgments

  • Inspired by Tailwind CSS best practices
  • Built with love for the Tailwind community
  • Thanks to all contributors

Made with โค๏ธ by Praveenstein

Top categories

Loading Svelte Themes