A Ruby gem that connects to a locally running TailwindCSS language server to sort space-separated CSS classes.
Add this line to your application's Gemfile:
gem 'tailwind_sorter'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install tailwind_sorter
First, make sure the Tailwind CSS language server is running locally.
require 'tailwind_sorter'
# Sort your Tailwind CSS classes
unsorted_classes = "flex items-center justify-between py-4 px-6 bg-white"
sorted_classes = TailwindSorter.sort(unsorted_classes)
puts sorted_classes
# Output should be: "flex items-center justify-between bg-white px-6 py-4"
After checking out the repo, run bin/setup
to install dependencies. You can also run bin/console
for an interactive prompt that will allow you to experiment.
The gem is available as open source under the terms of the MIT License.