One way I have found HAML functionally useful is that it was easier to move code around the page. There are fewer lines to move, so it’s easier to remember exactly what you’re moving, and I don’t have to worry about forgetting to move the closing tag. You do have to re-indent after you move the lines, but you would do that anyway with plain HTML. I did a lot of moving code around the page when I implemented Photoshop designs, and I was thankful for that aspect of HAML.
I also used the embedded-Ruby feature to DRY-ly have variations on a page prototype. I was able to switch between four different versions of the page by changing just one variable at the top – I used case statements and a few Ruby helpers on the page to enable the appropriate sections and CSS classes of that version. That was for a static page not linked to any web framework – it was nice to be able to use code without having to set up a huge framework. It could have been messy mixing Ruby code with HTML in the same file, but since this was just a small one-off page, it wasn’t a problem.
Comments
One way I have found HAML functionally useful is that it was easier to move code around the page. There are fewer lines to move, so it’s easier to remember exactly what you’re moving, and I don’t have to worry about forgetting to move the closing tag. You do have to re-indent after you move the lines, but you would do that anyway with plain HTML. I did a lot of moving code around the page when I implemented Photoshop designs, and I was thankful for that aspect of HAML.
I also used the embedded-Ruby feature to DRY-ly have variations on a page prototype. I was able to switch between four different versions of the page by changing just one variable at the top – I used case statements and a few Ruby helpers on the page to enable the appropriate sections and CSS classes of that version. That was for a static page not linked to any web framework – it was nice to be able to use code without having to set up a huge framework. It could have been messy mixing Ruby code with HTML in the same file, but since this was just a small one-off page, it wasn’t a problem.