What to use .haml or .erb ?

91 views
Skip to first unread message

Fahim Patel

unread,
Nov 7, 2012, 2:29:22 AM11/7/12
to rubyonra...@googlegroups.com


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.



Thanks 

Best Regards 
Fahim Babar Patel 


Tommaso Visconti

unread,
Nov 7, 2012, 4:12:11 AM11/7/12
to rubyonra...@googlegroups.com
Fahim Patel ha scritto:
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 :)

Colin Law

unread,
Nov 7, 2012, 4:45:02 AM11/7/12
to rubyonra...@googlegroups.com
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

Fahim Patel

unread,
Nov 7, 2012, 5:03:06 AM11/7/12
to rubyonra...@googlegroups.com
Thanks lot reply.

I waiting for reply on this question.

Fahim Patel

unread,
Nov 7, 2012, 5:03:41 AM11/7/12
to rubyonra...@googlegroups.com


On Wednesday, November 7, 2012 3:33:06 PM UTC+5:30, Fahim Patel wrote:


On Wednesday, November 7, 2012 3:15:55 PM UTC+5:30, Colin Law wrote:
On 7 November 2012 09:12, Tommaso Visconti <tommaso....@gmail.com> wrote:
> 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 :)

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.

Иван Бишевац

unread,
Nov 7, 2012, 5:35:37 AM11/7/12
to rubyonra...@googlegroups.com
I use both, but prefer haml, because it's concise.


2012/11/7 Fahim Patel <paf...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/CQNYAg51epgJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Colin Law

unread,
Nov 7, 2012, 7:06:48 AM11/7/12
to rubyonra...@googlegroups.com
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

>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-ta...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/VhxpwJO8s9sJ.

Vibin

unread,
Nov 7, 2012, 4:21:44 AM11/7/12
to rubyonra...@googlegroups.com
Performance wise its 10 time faster than ERB... :)

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
Thanks, Vibin..

Tomiwa Ijaware

unread,
Nov 7, 2012, 5:41:16 AM11/7/12
to rubyonra...@googlegroups.com
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.

Colin Law

unread,
Nov 7, 2012, 10:11:39 AM11/7/12
to rubyonra...@googlegroups.com
On 7 November 2012 09:21, Vibin <rubyrai...@gmail.com> wrote:
> Performance wise its 10 time faster than ERB... :)
>
> 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

>
>
> On Wed, Nov 7, 2012 at 2:42 PM, Tommaso Visconti
> <tommaso....@gmail.com> wrote:
>>
>> 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 :)
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonra...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-ta...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
>
> --
> Thanks, Vibin..
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-ta...@googlegroups.com.

Jordon Bedwell

unread,
Nov 7, 2012, 2:57:53 PM11/7/12
to rubyonra...@googlegroups.com
On Wed, Nov 7, 2012 at 4:35 AM, Иван Бишевац <ivan.b...@gmail.com> wrote:
> I use both, but prefer haml, because it's concise.

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.

Jason Fleetwood-Boldt

unread,
Nov 7, 2012, 4:08:04 PM11/7/12
to rubyonra...@googlegroups.com

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 :(

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


This email will make much more sense once you learn what "JST" is.
Reply all
Reply to author
Forward
0 new messages