Writing ERB templates doesn't have to suck
As previously noted, we’ve been experimenting a bit with Ruby on Rails. While I’m still just getting my feet wet, I have written enough views to know that writing ERB templates sucks. ERB itself isn’t the problem. Neither is any specific pattern or logic or anything else the issue.
Here I am happily typing away
when suddenly I have to type this mess <%= %>
.
That has got to be the most inconvienent character sequence in the history of ever. It breaks any sense of flow I had going on. It just really rustles my you know whats.
Fortunately, this is the internet and the internet has a solution for everything.
Enter ERB-Sublime-Snippets. It’s pretty much Emmet for ERB. Which is awesome, cause I love Emmet.
The one catch though is if you have both installed there is a slight conflict between the two. Rendering an HTML form and a form_for helper are both accomplished with Tab Trigger “form”.
I solved the conflict by adding this little bit to my Emmet.sublime-settings file.
{
"disabled_single_snippets": "form"
}
That disables the HTML Tab Trigger from Emmet. I never used it so it wasn’t an inconvience for me. I’m sure there’s some way to remap the triggers or something if this solution doesn’t work for you.