Haml 1.7
Posted by jamis July 10, 2007 @ 05:20 PM
The Haml team recently announced the release of Haml 1.7, which is an alternative markup system that you can use in Rails, instead of the default ERb-based markup. Version 1.7 is significantly faster than previous releases (and is almost as fast as Rails’ default system, now!). There are a few other new features, too: read all about it in the release notes. Great work!

Ew.
I don’t know why, but I really don’t like HAML syntax much.
shrug I don’t suppose that’s really a problem – it’s a matter of “use it or… well, don’t” isn’t it? :)
-Random8r
What’d be really good is if we had some kind of open thing that had a bunch of really nice things built in.
Like a standard library of CSS and HTML, including the images, or something.
I’m yet to see some really nice CSS books with this recipe-approach. We need a version of that awesome “rails way” site for CSS.
Wanna do this? Build it like this… wanna do this? Read these bits, and combine them like this..
We don’t need more concise, cryptic ways to represent HTML and CSS, what we really need is libraries of solutions – piggy-back off each others’ shoulders.
Same with Rails apps. We need some way to bring these libraries into one common fold… so we can use parts of them, much like we use gems in the ruby world.
Just some thoughts.
- Random8r
random8r:
You should build something and call it engines! One size fits all solutions for everything.
.............
Get a job doing Drupal or something.
Hate on haml/sass all you want… I feel like it’s sped up my coding 300%. Honestly, rhtml and css feel like running underwater compared to h&s.
Yet another syntax to learn…
It took me about 10 minutes to learn Haml, and I probably got that time back about 20 minutes later!
HAML is awesome going back to RHTML is such a pain in the ass now.
SASS is also great and makes me actully want to cascade my stylesheets properly.
Easily the best templating system I’ve used so far and with these speed increases in performance I couldn’t ask Santa for a better present also my wrists feel so much better since I type so much less.
In other news, Markaby continues to appear dead…
HAML saved my sanity.
@H:
Drupal? LoL I hate drupal. It’s revolting.
The fact that HAML uses meaningful white space reminds me of Python.
I’ll give Haml a go. From looking at it I don’t like it, but we’ll see what happens when I use it ;-)
Okay, I just sat down and did the tutorial again (I did it once the other day after I’d made my frist comment).
Haml seems nice and compact.
I did a couple of pages that already existed in a site I have… but… I ended up doing things slightly differently, and ended up typing more code in HAML because my text editor (TextMate) isn’t set up to handle two-spaces very well, and it has a couple of things built in for Rails templates by default which make it much easier to do HTML and ErB templating.
The trouble I had was that I coudln’t seem to work out how to do inline wraps… say for instance, that I want a word to be bold mid-line. How am I supposed to do that? I couldn’t find it anywhere in the documentation, or tutorial. I looked through the source and that didn’t help either.
I think the only way you can do it is by putting that on another separate line.
It really doesn’t seem like it’s very good yet.
And I really don’t like the meaningful white spaces – in long pieces of mark up, it just gets longer vertical (which tend to be what happens for me anyway), and this means that it’s really hard to see what level you’re on at any particular point. This is why tagging is better IMHO.
I still maintain my previous comments.
- Random8r.
The documentation/tutorial probably needs improving.
There is a Haml bundle for TextMate and for a few other editors including Eclipse/RadRails/Aptana:
http://groups.google.com/group/haml/web/syntax-highlighting
As to “not handling two spaces very well” in TextMate, I use two spaced soft tabs in Ruby and RHTML exactly the same as in Haml so I don’t know what you mean about that. Look down at the bottom of the editor for the tabs setting.
Putting stuff bold in the middle of a line is easy but not obvious at first. Just type html in your text. For example:
%p Some bold text
Haml is supposed to show document structure, nothing wrong with using plain old fashioned tags inline for something like this.
As to “it just gets longer vertically”, this has also never happened to me. Haml files are usually much shorter vertically, I’m having a hard time even picturing how you are structuring your files if it is making them longer.
The main payoff for me is not tracking down unmatched tags in nested sets of partials. Try working on a project with several people in RHTML and playing “Find the extra close tag someone slipped into a partial somewhere that is now wrecking your layout.” I can assure you that this game is very boring and using Haml means not having to play it anymore.
I just decided to give Haml a try last night and within 10 minutes I seemed to be reasonably proficient in it.
At that point I sat back and compared side by side the erb and haml that I converted. I just really liked the clean syntax of haml and decided to change over all my views and partials. I was able to do that very quickly and I’m very happy with how clean the views have become. Very easy to see what’s happening and no chance of leaving tags open etc.
It’s a bit dissapointing that it’s slower than erb but with the speed increases that it’s had recently it seems promising that this will be solved.
Great Stuff
wijvkeos3mgxav8 utyup1k73scw azwjv9i0njo2
My trouble is with helpers. The concat thing is really annoying and playing with strings isn’t nice. The only good solution I found was Markaby, but didn’t tried yet.
What are you guys using in helpers?
I looks like 3rd rail (IDE from Borland/Codegear) may have support for haml
ghrwg849yc p6eva6ocb0jl36 34wb5ua4yd0pkeog