

Haml Sucks for Content - chriseppstein
http://chriseppstein.github.com/blog/2010/02/08/haml-sucks-for-content/

======
raganwald
terrible title, this post actually explains how to use Haml the plugin to
generate all sorts of content using its existing features like filters
properly. The confusion is that "Haml" refers to Haml the plug-in as well as
Haml the syntax for generating HTML. The syntax is not ideal for content, and
that's why it supports things like inline HTML and markdown filters, just as
the outline explains.

~~~
grandalf
The title is in the reddit linkbait genre that is becoming increasingly common
on HN.

~~~
raganwald
On Twitter, someone gave an alternate explanation that I'll pass along without
agreeing or disagreeing. They suggested the title was a honeytrap to get Haml
haters to read the post and then be surreptitiously educated on why that
argument against Haml is invalid.

Update... That was Chris' explanation!

~~~
twism
Well I got caught in that honeytrap, so the title does work.

------
mhartl
As an experienced and enthusiastic Haml user, I find that this matches my
experience exactly. If you're a Haml-hater, please read this post.

------
marstall
the only thing it's really ideal for is software engineers writing their own
HTML. in professional team environments in my experience designers always like
to be able to at least dip in to HTML, and as "illogical" as this might seem
to a programmer, they are _never_ going to learn something like HAML - it's
just too complex and programmery.

~~~
coderdude
I'm half programmer, half Web developer. I'm great at both (I don't mind
saying). Being from both worlds, I don't get the need for HAML. HTML is so
easy as it is. From my point of view, any programmer who can't write HTML with
proficiency is deficient somehow.

~~~
tptacek
Wow. You definitely are half a programmer! Burned!

HTML is a huge pain in the ass to write:

* It requires balancing tags

* It's verbose

* It is crudded up with syntax (</-="") and keywords

* It consistently runs right off the 80 column right margin

* It's an enormous pain to extend

* It's slow to read; for instance, try picking the plural version of a constantly-used class name out of tag soup

Haml isn't a shortcut to writing HTML. On the contrary, to use it well, you
have to know HTML well. What Haml does is to solve the problems that make HTML
a pain to use to express user interface in.

~~~
coderdude
I guess I set myself up? You make some good points about why HTML is a pain in
the ass. I'm just desensitized to it to the point that it doesn't bother me
anymore. In fact, I didn't even think of the issues you brought up.

~~~
tptacek
I was once like you.

What it took for me was writing a UI in Haml with very minimal, semantic
markup and all the controls keyed in jQ off classes and IDs.

When you structure your HTML, CSS, and Javascript correctly, Haml is
absolutely gorgeous. You're no longer writing in HTML: you're writing in a DSL
designed to express user interface. For instance, a "save" button encoded in a
DIV in Haml:

    
    
        .button#save
    

That's it.

~~~
coderdude
Does Haml allow you to control how the actual markup is produced? Some
browsers are dependent on a lack of whitespace between nodes in order to
render properly without adding some extra padding (IE for instance). For me,
the main issue is control over my markup. Exact and precise control, which is
necessary.

~~~
jerhinesmith
Haml does allow for finer-grained control over whitespace, but even if that's
not enough, when needed you can still "embed" plain-old html directly inside
of your Haml files.

I guess I fail to see how html has any advantage over haml. The absolute worst
case is that you're still writing html in 90+% of the cases (which you'd be
doing anyway without haml), and in the best case, your markup becomes much
more DRY and readable.

~~~
jfarmer
HTML has an advantage because that's what people know, particularly designers.

Some designers I've worked with are ok with haml, others steadfastly refuse
because their workflow is so HTML-centric.

~~~
chriseppstein
Tool support is a good reason to not use haml. I expect tool support will be
there some day, but it's not really there yet. RubyMine has very nice haml
support tho.

