TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Thoughts on Haml

17 pointsby villageidiotabout 16 years ago

10 comments

bradgesslerabout 16 years ago
James is right on about where HAML falls short; but thats not HAML's problem, its more of a preference. I will be the first to say that HAML is no appropriate for everything. Here is how I apply various templating engines in my Rails projects:<p>HAML - Great for application markup (as opposed to document markup... see ERB below) for a number of reasons. (1) application markup tends to be heavy in javascript where you need a clean DOM. HAML reduces the chance of screwing up the DOM and makes it easier to look at during development. (2) Lots of conditionals in the view and I'm too lazy to factor them out into partials or helpers. Sometimes its just easier to express if/then and loops in HAML than it is in ERB... slightly less markup.<p>ERB - Document/content markup. If I have big docs with lots of links and paragraphs, but nothing to heavy going on thats dynamic/conditional, ERB is the easiest way to go.<p>Mix 'n' match! Then you can have the best of both worlds!
评论 #589722 未加载
carbon8about 16 years ago
Eh, different strokes for different folks. My only major criticism of Haml is that it makes me actively adverse to how incredibly verbose HTML is, which probably isn't a good trait for a web developer.
评论 #589422 未加载
nixmeabout 16 years ago
I'd say his main points boil down to poor tooling and creating a solution for a problem that doesn't really exist... except that many of us do see issues with existing templating options and Haml+Sass works really well.<p>I will concede that it can cause friction with designers though.
jdminhbgabout 16 years ago
I don't understand the criticism that it's for people who don't understand HTML. How could you even use it if you didn't know HTML?
评论 #589241 未加载
_piusabout 16 years ago
This was me until about the 3rd time I played around with Haml. Then it occurred to me how much noise I got rid of by using it, after which I was hooked.<p>Jquery + Haml is a very close impedance match and a real pleasure to use for development.
评论 #589395 未加载
melvinramabout 16 years ago
I use real code to show how HAML kicks ERB-ass: <a href="http://railsnotes.com/395-response-to-thoughts-on-haml" rel="nofollow">http://railsnotes.com/395-response-to-thoughts-on-haml</a>
评论 #589424 未加载
dougpabout 16 years ago
Web designers often send me half heartedly formated html that is full of repetitive nested structures that I do not understand. When trying to turn it into a collection of partials I have inevitably destroyed some important tag. Everything breaks and I have to start over.<p>Turning it into haml has two benefits. I can visualize the structure of repeating elements so I have a better idea what to break into partials and I will never forget a closing tag which causes everything to break in some horrific way.
zacharypinterabout 16 years ago
I agree with the author on editor support for closing tags. I often find myself noticing something is wrong when I tell the editor (emacs) to auto-indent everything and it doesn't look the way I expect it to. I also find ERB to be quite simple and straightforward.<p>That said, I'm quite interested in using Sass.
raganwaldabout 16 years ago
I like James' perspectives, but the "If programming X irritates you, get better tooling" argument reminds me of another programming language, Java.
villageidiotabout 16 years ago
This post is a negative critique of Haml which points out that it is not an improvement over HTML - it makes working with designers more cumbersome for one thing. A somewhat different viewpoint from a StackOverflow user:<p><a href="http://stackoverflow.com/questions/93540/your-attitude-to-haml/430325#430325" rel="nofollow">http://stackoverflow.com/questions/93540/your-attitude-to-ha...</a>
评论 #589418 未加载