HAML

Anyone use HAML out in the wild?

What do people think?

Worth the effort?

Or is HTML sprinkled with RHTML the thing to stick to and do right?

Hi Luzzy

I did download it but have not found time to check it out.

As per the README :-

Haml and Sass are templating engines for the two most common types of
documents on the web:
HTML and CSS, respectively.

They are designed to make it both easier and more pleasant to code
HTML and CSS documents,
by eliminating redundancy, reflecting the underlying structure that
the document represents,
and providing elegant, easily understandable, and powerful syntax.

I love Haml; I have used it in my last five projects and it definitely
speeds me up, results in fewer typos, and generally is a joy to work
with. It takes a little getting used to, but once you've got it you
will move much faster in coding views.

At least half the value of Haml is Sass. Even if you don't want to
use Haml, Sass provides a much more sensible way to create and
maintain stylesheets (such as use of constants, automatically nesting
selectors for you, etc.)

-Mike

We just started using HAML and LOVE IT. We put it off for a while
because of its speeed, but now with the latest update made huge
improvement in speed. Now it is on par with Erb and they say there is
much room for improvement. The productivity gain is more than worth
it, the code is clean an beautiful. You do have to get used to the
syntax but shortly it all comes together.

We haven't gone full speed ahead with Sass yet but we will soon.

HAML is absolutely beautiful. The only reason *not* to use it is if it
doesn't fit in with your team's workflow (e.g. if they use visual design
tools or other processing tools, or if there are just too many people who'd
have to learn it).

If you are your team, go for it - you'll love it.

There have been a lot of responses from people who love HAML, so I thought
I'd put in my dissenting opinion. I have two major problems with it, though
one is a pet peeve.

First, I have a problem with semantically meaningful whitespace. Yes, it's
a pet peeve, but that doesn't necessarily mean it isn't a valid issue. I
consider it a readability issue, for the most part, since while I can see
the presence or absence of whitespace, or a close brace, or an end very
easily, I can't easily judge the width of an indent. Yes, I know that
relative indent is what it's all about but even that is an issue when
outdenting (i.e. when I am ending an indented block, how many levels of
nesting am I ending?). I also think it limits the ability of an editor to
help navigate a file. This is the primary reason I have never bothered with
Python.

The second and more objective problem is that it involves thinking in yet
another language. If you are doing web development, you should already know
and be comfortable with HTML and CSS. Additional Ruby markup, even with the
Rails DSLs, isn't an increase in cognitive load since the rest of the
system is already in Ruby/Rails. HAML and Sass, however, require thinking
in an additional language that includes meaningful whitespace (unlike every
other language one might know, particularly Ruby, HTML, and CSS, except
Python). There's nothing wrong with learning to think in another language,
but switching tracks within the same project should be minimized.

There is something to be said for generating complex CSS from a more
concise representation, but even that can and should be accomplished using
the existing tools, i.e. ERB. I had occasion to generate some CSS, and
used the Rails generator system, which relies on ERB. Incidentally, if you
have truly dynamic CSS files, you have a system design problem rather than
a need for a library/language to simplify implementing it.

--Greg

I have converted all my Rails sites to Haml. It saves me a ton of
time and Sass is much clearer for me to read/write than is CSS. It
will take you some getting used to if you are used to sprinkling
*ruby* into your rhtml because that is best hoisted out into helpers
in Haml. But Hamlites will tell you that makes your code easier to
reuse, test, and read. I agree.

Luzzy wrote:

Anyone use HAML out in the wild?

What do people think?

Worth the effort?

Or is HTML sprinkled with RHTML the thing to stick to and do right?

+10 for pure haml... clear, concise, and I'm used to reading the 2 space
indent from my Rails/Ruby code anyway.

Why the question about rhtml mixed in? - I haven't found the need to
revert any part of any form back to rhtml yet...

Are there any simple tutorials to get started with HAML?
Thanks.
Bharat

Bharat Ruparel wrote:

Are there any simple tutorials to get started with HAML?
Thanks.
Bharat

This link

http://haml.hamptoncatlin.com/docs/rdoc/classes/Haml.html

will drop you onto the docs, and it really is simple conceptually, it's
just a syntax change from rhtml.

There is also a tutorial at

http://haml.hamptoncatlin.com/tutorial/