Lieven Cardoen
Lieven Cardoen

Reputation: 25959

Is there a way to format erb files?

I'm searching for a plugin (Sublime Text, Eclipse, Notepad, ...) to format erb files. I've searched a while and haven't found anything that's working fine.

Upvotes: 2

Views: 1573

Answers (2)

lulalala
lulalala

Reputation: 17981

I have tried a few vim plugins, however they do not work well.

I then tried https://github.com/threedaymonk/htmlbeautifier, a gem that you can execute to format erb files. It has a much better success rate dealing with complex erb files. If it doesn't work (which I have encountered once), then it is probably you missing a closing

Upvotes: 0

Samer Buna
Samer Buna

Reputation: 9311

vim file.html.erb
:set ft=html 
gg=G

This would ignore erb tags though, for a better support of those, get the Rails.vim plugin and set ft=eruby

Upvotes: 1

Related Questions