Looking for Sass?

#haml.about

Haml is a markup language that’s used to cleanly and simply describe the HTML of any web document without the use of inline code. Haml functions as a replacement for inline page templating systems such as PHP, ASP, and ERB, the templating language used in most Ruby on Rails applications. However, Haml avoids the need for explicitly coding HTML into the template, because it itself is a description of the HTML, with some code to generate dynamic content.

Core Principles

Haml’s development as a language is based on adherence to several core principles. These are:

Markup should be beautiful
Markup should not be used merely as a tool to get browsers to render a page how the author wants it rendered. The rendering isn’t the only thing people have to see; they have to see, modify, and understand the markup as well. Thus, the markup should be just as user-friendly and pleasant as the rendered result.
Markup should be DRY
HTML involves major repetition. Every element is named twice: once before its content and once after. ERB adds even more repetition and unnecessary characters. HAML avoids all of this by relying on indentation, not text, to determine where elements and blocks of code begin and end. Not only does this result in smaller templates, it makes the code much cleaner to look at.
Markup should be well-indented
One of the major problems with ERB is that not only does it not encourage well-indented code, it actively makes it challenging, or even impossible, to write. This leads to confusing, unreadable HTML, when it should be well indented and reflecting the underlying structure of the document. Haml automatically properly formats all tags to that it does.
HTML structure should be clear
XML and HTML are formats built upon the idea of a structured document. That structure is reflected in their markup, and it should likewise be reflected in meta-markup such as Haml Because Haml’s logic is based on indentation of child elements, this structure is naturally preserved, making the document much easier and more logical for mere humans to read.

History

Haml was created because Hampton got really annoyed having to keep hand-typing out templates. So many advances have been made in web-development, but the template has remained the same. Time for something new.

Based on those frustrations, Haml was born as an experiment. However, Haml quickly proved itself in several production-level websites created at Unspace Interactive. In fact, the entire company’s development team quickly shrugged off ERB completely and have gone entirely to Haml based development.

Haml quickly proved itself to be a productivity boon. Also, designers love Haml for its similarities to CSS.

Things are better in web development land since Haml arrived.

The Haml Team

Haml was originally created by Hampton Catlin, and he is the author of the first implementation. However, Hampton doesn’t even know his way around the code anymore and now just occasionally consults on language issues. Hampton lives in Jacksonville, Florida and is the lead mobile developer for Wikimedia.

Nathan Weizenbaum is the primary maintainer and designer of Haml. His hard work has kept the project alive by endlessly answering forum posts, fixing bugs, refactoring, finding speed improvements, writing documentation, implementing new features, and planning the future of the language. Nathan lives in Seattle, Washington and, while not being a student at the University of Washington he consults for Unspace Interactive or interns at various software companies.

License

The Haml implementation is available under the MIT License.