[ANN] Haml 1.0 - Stable Sam (!)

I totally forgot to make this announcement anywhere except for the Haml
mailing list. Whoops!

On December 25, 2006, we released Haml 1.0!

Today we’re at 1.0.2. Give it a whirl!

./script/plugin install svn://hamptoncatlin.com/haml/tags/stable

We feel that Haml is now at a nice stable place and is feature rich
enough to blow away any of the template languages you’ve used in the
past. We listened to what you guys wanted, and we have delivered
without diluting the original ideals.

Haml is not just a one off “cool idea” for nerds. It has garnered a
proven track record for both Software Developers and Web Designers. At
Unspace, we continually use it for all of our projects and are even
more committed to using it in the future. Flat out, Haml makes us more
efficient and better programmers. It makes our code short, to the
point, manageable and sexy.

In fact, Haml is even getting coverage in the upcoming Apress book
“Beginning Rails” as the goto high-productivity way to create your
templates.

I know a lot of you looked into Haml right after the initial talk and
haven’t really given it another glance, but I’d highly recommend you
read this http://hamptoncatlin.com/2007/haml-1-0-stable-sam It gives a
run down on the “road to 1.0” and what we’ve added.

------------ The Future ------------

Also, we are hard at work on the 1.5 branch where we are going to
release something that is basically an abstraction of CSS. Why? Because
we think CSS is ugly and bloated and our poor designers are floundering
in its painful syntax. We will be rolling out Sass in not too long.

Into the future beyond that, we are looking to build a fragment cache
for use around your site. LetIt::REST is a tool for helping you keep
your Rest controllers as simple and straight-foreward as you can muster
(imagine a configurable Rest controller in 4 lines. No joke!).

Haml represents more than just a template language. It represents a
flowering of Rails around a philosophy of simplicity and customization.
It represents a new way to think about your CSS classes, your model
classes, your view classes, and the structures and rules around those
things.

Go find out more about the current state of things at
http://haml.hamptoncatlin.com

To ride the edge… and see these new features…

./script/plugin install svn://hamptoncatlin.com/haml/trunk

Not at the moment.

But there is nothing about the language specification that ties it to
ruby. So, I’m excited to see it get converted to another language. If
my Java skills weren’t so rusty, I’d be on it already.

-hampton.

Congratulations!

I look forward to seeing your style language.

Is anybody implementing Haml for Java or Groovy?

Happy New Year!

Justin F.

I think I’m ready to make use of Haml. I remember your original
announcements a number of months ago and the project certainly has
matured
since. The documentation I’ve read is a little light on the subject of
integration with a Rails app.

Is it possible to use Haml out-of-the-box for ActionMailer templates?

Can one construct their layouts in the same manner as rhtml templates
using
content_for_layout to fold in view templates?

Thanks!

Taylor S.,
Reality Technician

Thanks for the response, Justin.

I got pretty into using Haml very quickly, and figured out as you told
me
that it did in fact work fine with ActionMailer.

I have had some frustrations occasionally when tab order in templates.

For example, I’ve had problems with code like this not having kEND
closures…

%table.list
%thead
%tr
%th
This
- if this and that
= this_function
%tbody
%tr
%td This and that and this

( I just did that on the fly, but assume all spaces line up as they are
supposed to where I consider table, thead, tr, th, and td all to be
“block-enducing” (and thus indenting) tags.

Am I just delusional about my tabbing?

Thanks

The code is so much more readable in this fashion and I’d like to
convert my
site a bit more to it if I could get around some of these small issues
I’ve
been having.

D. Taylor S.,
Reality Technician

Taylor-

Haml does work out-of-the box with ActionMailer. Haml integrates in
with ActionView totally so that ActionView knows what to do when it
seems Haml. If something is broken with that side of our integration,
post about it and we will get it fixed up for you.

Haml works just like your Rhtml templates in its relation to Rails.
ActionView notices that a file ends in .haml and will render it using
the Haml engine. A common layouts/application.haml file might look
something like this.

!!! Strict
%html
%head
%title= controller.controller_name
= stylesheet_link_tag :defaults
%body
#page
#header
%h1= My Website
= render :partial => ‘shared/logged_’ + (logged_in? ? ‘in’ :
‘out’)
#content= content_for_layout
#footer
Copyright Hampton Catlin 2007

Also, you can use ‘yield’ instead of content_for_layout. This is a
pretty common file in most of my projects. And, its the one I’d usually
recommend people switch to first. Even with a legacy project, you can
give Haml a spin by converting the application.rhtml file over to
application.haml. The biggest bonus there is that your website’s XHTML
will instantly look much better.

I find the delete key to be my favourite key on the keyboard. I love
going around and deleting all the cruft from my old rhtml files and
looking at my new streamlined Haml file.

Anyhow, goodluck. Stay in touch and feel free to ask questions.

-hampton.

On Jan 13, 8:35 pm, “D. Taylor S.” [email protected]

When you are doing a block in Haml, you have to indent.

To do this…

<% if current_user %>
<%= print_user(current_user) %>
<% else %>
<%= render :partial => ‘signup’ %>
<% end %>

Would be

  • if current_user
    = print_user(current_user)
  • else
    = render :partial => ‘signup’

So, you must indent while you are inside of the block. The next line
that is even with an open block, will instantly close it.

-hampton.