CSC 486: CodeWorkout: HAML



The team and I as you know are working on a Ruby on Rails and it is my first working on a project like this CodeWorkout. This being said I have been working hard to gain an understanding of Rails and now, I am writing about for everyone to see my question and follow along with my research. This time, around I am writing about HAML and my own questions surround it. I am going to go section by section of what I am reading along with questions and the answer I have found. Then follow by a quick summary of the article.


What is HAML? (The follows highlighted text is found on Wikipedia:)

Haml (HTML AbstractionMarkup Language) is a templating system to avoid writing the inline code in a web document and make HTML easy and clean.

Why use HAML?

Haml gives the flexibility to have some dynamic content in HTML. Similar to other web languages like PHP,ASP, JSP and template systems like eRuby, Haml also embeds some code that gets executed during runtime and generates HTMLcode in order to provide some dynamic content.

To see more information:


This is great because we are using eRuby in our project. After looking at eRuby in our project. After looking at for more information, HAML is pretty Straightforward. HAML seems to be very easy because you can just convert Erb (eRuby) or HTML into HAML.

For Example: (This example is taken from

Adding Attributes

Simple tags are all well and good, but what about adding attributes to tags?


<strong class="code" id="message">Hello, World!</strong>


%strong{:class => "code", :id => "message"} Hello, World!

The attributes are just a standard Ruby hash. The class attribute is “code”, the id attribute is “message”. Notice that in this example, we didn’t use =, so “Hello, World!” is interpreted as a normal string, not Ruby code.

There is an easier way to define this tag in Haml, since class and id are such common attributes and since most designers (and developers) are familiar with CSS, we can use similar notation to describe this tag.


As you see above, HAML just needs simply changes making very easy to use. This proves seems very consistent throughout the rest of the HAML tutorial on



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s