Herbalizer is a tool for converting HAML to ERB. While HAML is more concise than ERB, it’s also a lot stuffier, and simple things like embedded a < span > inside a paragraph require ugly transformations. And tabs will ruin your life. This isn’t Python.

So, how to run herbalizer on a directory of views? Well, I had to write a script for that. Here it is:

Also embedded in the script is a list of things herbalizer doesn’t convert well. If any of your files fail to convert (and it’s likely they will), check within 2-3 lines of the stated error for any violations of those rules, and change the syntax to something more herbalizer-friendly. It’s also likely you’ll have to go through and clean up afterwards: fixing nested syntaxes and suchlike.

Herbalizer is a long way from perfect, but for what’s most likely a one-time excruciatingly painful process, it can cut out about 80% of the work, which is super helpful.