The title of the post is more-or-less a verbatim quote from a coworker, as well as from an unrelated colleague of mine from a previous job. I was asked that question and, to be honest, I was a little thrown both times. I didn’t actually know why I use HAML. I guess I’d never really considered it much after I started doing everything with it. It just seemed better and more fun.
Oddly enough, I want to do Sass, but not Haml. Html isn’t too hard to begin with, and I guess it’s never bugged me.
What I do dislike about Haml is the indentation on a larger piece of code. When I want to shift elements around, suddenly, I’m not sure which level of indentation to put it, let alone make sure all the sub-levels are indented correctly as well. haml-mode in emacs didn’t seem to help much.
This means either two things:
- web markup should be more shallow and I’m doing it wrong. Perhaps with rails helpers and partials I can compress it more to keep myself DRY.
- The very Nature of web markup is a deeply nested tree, and haml’s indentation’s not a right fit for it. This seems more likely, though again, it depends on the design of the page. If a page is designed to be with heterogenously abundant page elements, then this is true.
I’ve yet to decide on either. Perhaps I’ll give Haml another shot.
CSS, on the other hand, has a fairly shallow structure. In fact, it doesn’t have nested structures at all, and you have to re-declare parent tags. This lends itself to really long files that I can’t keep track of. I’ve often wished for color variables too. SASS indentation is good here because it gives you a way to group your css together in a more compact way with hierarchy.
Hence, HTML is too deep for whitespace indentation, and hence in my opinion, not a good fit for HAML. And CSS is too shallow, and hence perfect for SASS.
So it’s not that I don’t want to learn HAML because it’s something-new, but because it doesn’t seem to fit a need I have for the markup I’m working with. SASS, on the other hand, solves a pain problem I’ve had with CSS.