I'm thrilled to share my first published Ruby gem: rustywind-ruby.
Its a wrapper for RustyWind, a rust-based CLI utility for sorting Tailwind CSS classes. This makes it easier to use in Ruby and Rails #nobuild projects.
Why I built it
I've been using Tailwind CSS for a while and RustyWind keeps my utility classes predictable.
Unfortunately, RustyWind is not available through RubyGems or bundler. Tailwind CSS itself recommends Prettier, an npm package, to sort CSS classes. Since I've been embracing importmaps and #nobuild recently this was a problem.
As RustyWind is a small standalone binary, I used the bin/setup
script to import it. This worked, but it didn't feel great having a dependency outside of my Gemfile.
I decided to follow the lead of the tailwind-ruby project, building a small wrapper around the RustyWind binaries. This allows bundler and your Gemfile to manage it like any other dependency.
It was also the perfect scope for my first gem.
How to use it
via bundler:
bundle add rustywind-ruby
or without:
gem install rustywind-ruby
Then use RustyWind via bundler exec
bundle exec rustywind
Personally, I run RustyWind as part of a bin/check
script alongside other actions such as tests, linters, and audits.
Future plans
A future update will be to have GitHub Actions sync with the RustyWind upstream repo to keep versions up to date automatically.
For now though, it works as expected.
If it doesn't for you, let me know in the GitHub Issues.