DEV Community

Mark Hesketh
Mark Hesketh

Posted on • Originally published at markhesketh.com on

1

Introducing: rustywind-ruby

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
Enter fullscreen mode Exit fullscreen mode

or without:

gem install rustywind-ruby
Enter fullscreen mode Exit fullscreen mode

Then use RustyWind via bundler exec

bundle exec rustywind
Enter fullscreen mode Exit fullscreen mode

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.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs