Tailwind Sorter screenshot

Tailwind Sorter

Author Avatar Theme by Nejremeslnici
Updated: 8 Aug 2024
32 Stars

A ruby gem to sort the Tailwind CSS classes in your templates the custom way.

Overview

Tailwind Sorter is a Ruby gem designed specifically to organize Tailwind CSS classes in your templates efficiently. It’s tailored for developers who prefer a customized sorting method that may differ from usual conventions, addressing a gap in the functionality of existing tools. The gem boasts both a sorting library and a standalone executable script, offering flexibility by either editing files directly or generating warning messages for integration with tools like Overcommit and Lefthook.

What differentiates Tailwind Sorter from other solutions is its capability to manage non-standard template formats, making it an excellent choice for RubyMine users while supporting Slim templates out of the box. As web development continues to evolve, having a sorting tool that can adapt to custom utility classes and individual developer preferences is invaluable.

Features

  • Custom Sorting: Tailwind Sorter allows for unique sorting configurations, letting developers implement their preferred class order rather than relying on predetermined options.

  • File Editing: The gem can edit files in place, making it a streamlined solution that can be used with file change watchers for automatic sorting.

  • Duplicate Removal: Automatically removes duplicate Tailwind classes, ensuring clean and efficient code in your templates.

  • Cross-IDE Support: While designed with RubyMine in mind, it also works seamlessly with other environments, including Slim templates, making it versatile across different setups.

  • Standalone Executable: The added convenience of a binstub allows for easy access and execution of the sorting script without needing complex setups.

  • Extendable Configuration: Users can customize their experience through an easily editable YAML configuration file, allowing for tailored regular expressions and class grouping.

  • Lightweight Installation: With no external dependencies other than Ruby itself (tested on Ruby 3.1+), installation is straightforward for developers familiar with Ruby environments.

  • Easy Customization: A low-code approach allows developers to create or modify sorting scripts quickly, promoting a hands-on experience for maintaining unique class orders.