News for hackers. Stuff that matters.
Re:I Heart SASS, But HAML, I'm Just Not That In To You by moe on Wednesday May 04, 2011 @03:47PM (#2515019)
There are some things that HAML simply won't do

Like what?

I have never bumped into anything haml wouldn't let me do. Does the author know that he can embed raw HTML with :plain and friends? (which, btw, are very rarely needed in practice)

Re:I Heart SASS, But HAML, I'm Just Not That In To You by wwarneck on Wednesday May 04, 2011 @04:02PM (#2515076)
The most common problem is conditional nesting, like with wrapper divs. In addition to :plain there is also :erb. I think the poster was implying that occasionally you'll need to structure code in a way that is not optimal (work arounds) to do something that requires no special work in erb.

I also wanted more specifics though, I felt like this was a fine opinion piece but lacked any specific world lessons.

Re:I Heart SASS, But HAML, I'm Just Not That In To You by snprbob86 on Wednesday May 04, 2011 @04:16PM (#2515130)
Conditional nesting is pretty easy using the "capture" method:

  - conditionallyNested = capture do
    .foo
      .bar
        baz
  - if f(x)
    .wrapper
      = conditionallyNested
  - else
    = conditionallyNested
Personally, I prefer this over duplicating the condition:

  <% condition = f(x) %>
  <% if condition %><div class="wrapper><% end %>
    <div class="foo"
      <div class="bar">
        baz
      </div>
    </div>
  <% if condition %></div><% end %>
However, you can trivially abstract my first example out into a helper and result in code looking like this:

  = wrap_if f(x), :class => 'wrapper' do
    .foo
      .bar
        baz
Much nicer looking, in my opinion. I don't consider this a workaround at all.