Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i get eclipse to interpret .ejs files as .html?

i recently started on a node project and two of the modules i'm using is express and EJS. but default i usually use eclipse as my IDE, it works well for java and decent for html and javascript. but one problem i'm having is that for .ejs files i get no markup color coding, or any form of code completion. it's basically just a plain file.

does anyone know how i can get eclipse to interpret .ejs files as .html files? i figure it's pretty similar except for the occasional embed tags. or a recommendation for an IDE more well suited to node.js/html/ejs development.

thanks!

like image 720
Khon Lieu Avatar asked Jun 14 '12 14:06

Khon Lieu


People also ask

How do I link an EJS file to an HTML file?

To link the ejs pages to either html, php pages, you need to go to the app. js file and set the view engine correspondingly. app. set('view engine', 'ejs'); app.

Can I use Javascript in EJS?

EJS or Embedded Javascript Templating is a templating engine used by Node. js. The template engine helps to create an HTML template with minimal code. Also, it can inject data into the HTML template at the client-side and produce the final HTML.

What is a .EJS file?

EJS simply stands for Embedded Javascript. It is a simple templating language/engine that lets its user generate HTML with plain javascript. EJS is mostly useful whenever you have to output HTML with a lot of javascript.


2 Answers

For a specific file, try right-click, Open With -> Other... -> HTML editor. You can also set the file association globally under Window -> Preferences -> General -> Editors -> File Associations.

On a Mac, the global setting is under Mac Option -> Preferences and all the same options.

like image 126
rlegendi Avatar answered Oct 14 '22 04:10

rlegendi


As an addendum to rlegendi's answer, if you'd also like the proper html coloring, you need to go to "Content Types" (right above "Editors" in the Preferences). From here, select Text -> HTML and click on "Add..", including .ejs

like image 39
Andrew Martin Avatar answered Oct 14 '22 03:10

Andrew Martin