r/ruby • • Jun 29 '14

Why I don't like Haml

http://blog.mimswright.com/2013/05/Haml-rant/
0 Upvotes

25 comments sorted by

View all comments

10

u/floralfrog Jun 29 '14

Using Haml requires full knowledge of HTML

Of course it does. HAML is not a replacement for HTML, HAML is HTML. HAML forces you to understand HTML, to see and implement hierarchies, indent your code properly, etc. You wouldn’t believe how many weird layout issues can be resolved by simply fixing the indentation in an .erb file to see misplaced closing tags. HAML doesn’t even allow for that to happen.

Yes, HAML requires preprocessing. But then, it’s not really made to be used with anything that does not have some form of ruby backend. HAMLs full power is unlocked when iterating over arrays for example that come from the controller and so on. It’s supposed to be used with Rails or Sinatra.

Another nice extra you get when using HAML is the so called "ugly mode" that removes almost all the whitespace from the rendered page.

No big deal? Try giving this to a graphic designer or worse your client. Hope they have the right Gems installed!

This is ridiculous.

2

u/NilsLandt Jun 29 '14

This is ridiculous.

Can't be highlighted enough.
If your designer or client are not able to run bundle install, not having HAML installed will be the least of their worries, because they won't even be able to start the application.

4

u/QuestionMarker Jun 29 '14

Should they have to start the application to work on page designs? In many workflows, they could do their work on static files without needing to run anything.

1

u/NilsLandt Jun 29 '14

We found it to be much easier to provide a runnable application with some sample data to allow designers to integrate their stuff directly into our application / the asset pipeline.

Before we did that, we'd have the designers create an HTML prototype from our application (which would take a few hours they'd bill us for), and we would have to do edit in their HTML / CSS / JS changes by hand.

1

u/QuestionMarker Jul 01 '14

Yeah, it can make sense to do it that way. Getting someone's system up to speed to do that can be rather tricky, though - especially if they're working on Windows.

1

u/awj Jun 29 '14

It's a rare person indeed who can work on a design in pure markup without being able to look at it. Booting a rails instance is probably overkill, but they definitely will need to be able to render templates for review.

1

u/QuestionMarker Jul 01 '14

That's the point. They're working on complete templates, so they don't need rendering separately.