What to use .haml or .erb ?

Hi all,

I have just move towards to learn Ajax . Before learning Ajax one big question raised to me what to use haml or erb.

From day one of Rails, i have used only .erb files.

I read DRY feature of haml and haml really impress me.

I really wish to use haml .

Before use i raised some questions :-

1 . Is there are more advantage execluding dry feature of haml over erb.

2 . Is there any limitation or drawback of haml .

  1. Give me some quick start to Ajax but should be simple because i have only theoretically knowledge of Ajax.

Thanks

Best Regards

Fahim Babar Patel

Fahim Patel ha scritto:

Hi all,

I have just move towards to learn Ajax . Before learning Ajax one big
question raised to me what to use haml or erb.
From day one of Rails, i have used only .erb files.
I read DRY feature of haml and haml really impress me.

I really wish to use haml .

Before use i raised some questions :-
1 . Is there are more advantage execluding dry feature of haml over erb.
2 . Is there any limitation or drawback of haml .
3. Give me some quick start to Ajax but should be simple because i have
only theoretically knowledge of Ajax.

I always use .erb but in the last project I had to use haml. of course it has a dry syntax, but my opinion is that it distorts the concept of templating language. The use of haml makes you learn another syntax different from html, but a view, at the end, is html..
I don't like it much :slight_smile:

Performance wise its 10 time faster than ERB… :slight_smile:

http://www.slideshare.net/graffzon/haml-vs-erb

I think haml is excellent and much prefer it to erb. But that just
shows that different tools suite different people. OP try it yourself
and use whichever one you prefer. Either will do the job.

Colin

Thanks lot reply.

I waiting for reply on this question.

  1. Give me some quick start to Ajax but should be simple because i have only theoretically knowledge of Ajax.

Fahim Patel ha scritto:

Hi all,

I have just move towards to learn Ajax . Before learning Ajax one big

question raised to me what to use haml or erb.

From day one of Rails, i have used only .erb files.

I read DRY feature of haml and haml really impress me.

I really wish to use haml .

Before use i raised some questions :-

1 . Is there are more advantage execluding dry feature of haml over erb.

2 . Is there any limitation or drawback of haml .

  1. Give me some quick start to Ajax but should be simple because i have

only theoretically knowledge of Ajax.

I always use .erb but in the last project I had to use haml. of course it

has a dry syntax, but my opinion is that it distorts the concept of

templating language. The use of haml makes you learn another syntax

different from html, but a view, at the end, is html…

I don’t like it much :slight_smile:

I think haml is excellent and much prefer it to erb. But that just

shows that different tools suite different people. OP try it yourself

and use whichever one you prefer. Either will do the job.

Colin

Thanks lot for reply.

I waiting for reply on this question.

  1. Give me some quick start to Ajax but should be simple because i have only theoretically knowledge of Ajax.

I use both, but prefer haml, because it’s concise.

I’m pretty new to rails, barely six months old in rails and I prefer haml to erb.

I’ve read about some ways to convert erbs to hamls, just in case you plan to switch completely to haml.

> Fahim Patel ha scritto:
>
>>
>>
>> Hi all,
>>
>> I have just move towards to learn Ajax . Before learning Ajax one big
>> question raised to me what to use haml or erb.
>> From day one of Rails, i have used only .erb files.
>> I read DRY feature of haml and haml really impress me.
>>
>> I really wish to use haml .
>>
>> Before use i raised some questions :-
>> 1 . Is there are more advantage execluding dry feature of haml over
>> erb.
>> 2 . Is there any limitation or drawback of haml .
>> 3. Give me some quick start to Ajax but should be simple because i have
>> only theoretically knowledge of Ajax.
>
>
> I always use .erb but in the last project I had to use haml. of course
> it
> has a dry syntax, but my opinion is that it distorts the concept of
> templating language. The use of haml makes you learn another syntax
> different from html, but a view, at the end, is html..
> I don't like it much :slight_smile:

I think haml is excellent and much prefer it to erb. But that just
shows that different tools suite different people. OP try it yourself
and use whichever one you prefer. Either will do the job.

Colin

Thanks lot reply.

I waiting for reply on this question.

3. Give me some quick start to Ajax but should be simple because i have only
theoretically knowledge of Ajax.

That is why it is best to only ask questions on one subject at a time.
I would start by using google, I am sure it will find lots of useful
stuff. A search for
rails ajax tutorial
looks like a good start. If you already understand the theory you
should have few problems.

Colin

Performance wise its 10 time faster than ERB... :slight_smile:

http://www.slideshare.net/graffzon/haml-vs-erb

I think you mis-counted the zeros. It suggests haml take 1.5 times as
long erb. However it is irrelevant either way as only a tiny
proportion of the total time is spent rendering either erb or haml.

Colin

I normally give clients a decision when the project starts (or make my
own based on what they express their technical skill to be at the
start of a project.) In short what I tell clients is "Do you know much
about HTML? Does learning something new really bug you or do you want
to work with what you know?" Those two questions help me decide
whether to use HAML which is concise like the above quote states or
use ERB which has a far less learning curve and for technology
disinclined people who know basic HTML, does not lock them out of
their own views.

For the performance issues, to me that matters not one bit considering
I do fragment caching and I do full caching depending on the page so
at that point the argument is moot, unless you are dynamically serving
every one of your pages dynamically which is ignorant to do even on a
small site. So in short the issues about "speed" in my eyes are
immature and ignorant to modern caching techniques for dynamic sites.

Check out Backbone.JS or Spine JS. (Newcommers will find Backbone's documentation better, but I've actually switched to Spine which I like certain parts of better).

For front-end tempting, you'll probably want .haml.jst. check these out

http://stackoverflow.com/questions/5254396/best-strategy-to-use-haml-template-with-backbone-js

https://github.com/netzpirat/haml_coffee_assets

This used to be how we did used haml with JST, but the repo is gone :frowning:

https://github.com/infbio/haml_assets/

This email will make much more sense once you learn what "JST" is.