Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERB in HTML background syntax highlighting with Sublime Text 3?

So I was following a Railscast and I noticed that inside of the html.erb file the ruby code has a faint background highlight effect to differentiate it from the rest of the HTML document.

I realize Ryan uses TextMate. I am using Sublime Text 3. How can I achieve the same effect? Thanks!

enter image description here

like image 588
MrPizzaFace Avatar asked Jan 11 '14 02:01

MrPizzaFace


People also ask

Does Sublime Text support syntax highlighting?

Sublime Text can use both . sublime-syntax and . tmLanguage files for syntax highlighting.

What is HTML ERB file?

erb" that means it's an HTML file with ruby code embedded in it and it is similar to ". rhtml" extension of rails file.

How do I highlight code in Sublime Text?

To enable Syntax Highlighting click on “View” in the top bar, then hover your mouse over “Syntax”, and select your programming language from the list. Alternatively, if you save a document with a supported file extension, Sublime Text 3 will automatically apply the Syntax Highlighting for that language.


1 Answers

Install the ERB package for Sublime Text.

Assuming you have the Sublime Text package manager installed*, just hit cmd+shift+P to get the command menu, than type install package and select

Package Control: Install Package

to get the package manager menu.

In that menu, type ERB and select the package when you see it. That's it!

*Here's how to install the package manager.

NB: Once installed, you'll need to make sure HTML (Rails) mode is set.

enter image description here

And here's what the coloring should look like (with Sublime Text's Twilight color scheme):

enter image description here

like image 125
Jake Romer Avatar answered Sep 30 '22 03:09

Jake Romer