Making TextMate recognize .html.erb files

Posted by Jason Noble on 09/21/2008 in ruby, ruby on rails, textmate |

I’m using TextMate to edit some Ruby on Rails code. I noticed that when I edit the view pages (i.e. index.html.erb) it does not do syntax highlighting. It turns out this is because the Ruby on Rails TextMate bundle thinks that ruby view pages are .rhtml, which is the old Ruby on Rails format.

You can fix this by editing the Ruby on Rails language bundle.

In TextMate, select Bundles -> Bundle Editor -> Edit Languages.

This will open a new Bundle Editor Window. Click the arrow next to Ruby on Rails and highlight HTML (Rails). In the code that appears on the right, change the following

fileTypes = ( 'rhtml');

to

fileTypes = ('rhtml', 'html.erb');

Click the red X in the upper left corner to close the Bundle Editor Window.

Close any existing .html.erb files, when you open them again, they will have ruby syntax highlighting.

Copyright © 2008-2017 Jason Noble's Technical Adventures All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.2.3, from BuyNowShop.com.