Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which RoR template engine is similar to the Razor template engine?

I've got really used to developing views in MVC4 using Razor. But I have to do a project in RoR and I'm pretty new to the whole Rails environment. I like Razor because it frees me from the <% business.

Can someone suggest a close cousin of Razor for Ruby?

like image 314
Roman Avatar asked Nov 09 '11 07:11

Roman


People also ask

Is razor a template engine?

Razor is a templating engine that was introduced with ASP.NET MVC, originally to run on the server and generate HTML to be served to web browsers. The Razor templating engine extends standard HTML syntax with C# so that you can express the layout and incorporate CSS stylesheets and JavaScript easily.

Which template engine is best?

Popular template engines Template engines are mostly used for server-side applications that are run on only one server and are not built as APIs. The popular ones include Ejs, Jade, Pug, Mustache, HandlebarsJS, Jinja2, and Blade.

What template engine is used in Node JS?

EJS is one of the template engines used with Node JS to generate HTML markups with plain Javascript. EJS stands for Embedded JavaScript Templates. It can be used both on the client and the server-side.

Does react use template engine?

The react-engine , on the same side it happens the use of the same rendering mechanism. However, instead of a template engine semantic, it uses JSX , or if we want, we can also use JavaScript . The JSX is, therefore, broader then template engines.


1 Answers

I only know of 3 options. As far as I know, there is no Rails templating engine that's exactly like Razor:

  • ERB is probably most similar to Razor
  • Haml uses slightly less verbose syntax and converts it into HTML. (No need to worry about typing div close tags 2 million times. Hurray!)
  • I prefer SLIM. It's like Haml but better because it has fewer characters and less weirdness (no need to type "%" before every line)
like image 156
Brian Avatar answered Oct 09 '22 14:10

Brian