Ask A Question

Notifications

You’re not receiving notifications from this thread.

Format erb files on save?

Joshua Steele asked in General

I haven't worked with erb in a while, and now I'm getting back to it. I use Vim as my editor (https://github.com/joshukraine/dotfiles), and I also use coc.nvim for code completion, etc. With JavaScript files, for example, I use Prettier to immediately fix trivial formatting issues when I save the file. However as best I can tell, Prettier does not currently support erb. (https://github.com/prettier/plugin-ruby/issues/371) What's the best solution these days for quickly formatting .html.erb files?

Thanks in advance for any suggestions!

Reply

I use HTML Beautifier, within vim you can make map with ':!htmlbeautifier %'

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.