Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Ruby
  3. Haml

Haml

MITRubyv7.2.0

A templating engine for HTML that eliminates redundancy and provides an elegant, indentation-based syntax.

Visit WebsiteGitHubGitHub
3.8k stars586 forks0 contributors

What is Haml?

Haml is a templating engine for HTML that provides an elegant, indentation-based syntax to eliminate redundancy in markup. It allows developers to write cleaner, more structured HTML documents by automatically handling closing tags and offering shortcuts for common patterns like classes and IDs. The engine embeds Ruby code seamlessly, making it a powerful tool for dynamic content generation in Ruby web applications.

Target Audience

Ruby developers building web applications who want cleaner, more maintainable HTML templates, especially those using frameworks like Rails. It's ideal for teams valuing readability and reduced boilerplate in their views.

Value Proposition

Developers choose Haml for its concise syntax that enforces structure through indentation, eliminating verbose closing tags and reducing errors. Its CSS-like shortcuts and Ruby integration offer a more pleasant and efficient templating experience compared to traditional ERB or plain HTML.

Overview

HTML Abstraction Markup Language - A Markup Haiku

Use Cases

Best For

  • Ruby on Rails projects seeking cleaner view templates
  • Teams wanting to enforce consistent HTML structure through indentation
  • Reducing boilerplate and closing tags in HTML generation
  • Integrating Ruby logic seamlessly into markup
  • Improving readability and maintainability of HTML templates
  • Projects valuing elegant, minimal syntax over verbose HTML

Not Ideal For

  • Non-Ruby web stacks like Node.js or Python applications
  • Projects where designers need to directly edit HTML without learning a new syntax
  • Teams that prefer explicit, verbose HTML for debugging and code reviews
  • Static site generators not supporting Ruby, such as Hugo or Gatsby

Pros & Cons

Pros

Indentation-Based Clarity

Uses indentation to represent HTML nesting, automatically handling closing tags—this reduces errors and mirrors document structure for better readability, as shown in the README's list and pepper example.

CSS-Like Shortcuts

Simplifies adding classes and IDs with #id.class syntax, defaulting to div for unnamed tags, making markup concise and intuitive, similar to CSS styling.

Ruby Integration

Allows embedding Ruby code with = for output and - for execution, supporting control statements like if and while for dynamic content generation seamlessly.

Reduced Boilerplate

Eliminates redundant closing tags and repetitive markup, leading to cleaner templates that are easier to maintain, as emphasized in the philosophy section.

Cons

Whitespace Sensitivity

Requires consistent indentation with no mixing of tabs and spaces; inconsistent levels can cause parsing errors that are tricky to debug, a noted limitation in the README.

Ruby Ecosystem Lock-in

Tightly coupled with Ruby, making it unsuitable for projects using other languages or wanting portable templates, limiting its adoption outside Ruby communities.

Steeper Learning Curve

The unique syntax and indentation rules pose a barrier for developers accustomed to traditional HTML or ERB, potentially slowing onboarding and collaboration.

Frequently Asked Questions

Quick Stats

Stars3,837
Forks586
Contributors0
Open Issues12
Last commit6 months ago
CreatedSince 2008

Tags

#code-simplification#html-generation#templating-engine#markup-language#rails-integration#web-development#ruby

Built With

R
Ruby

Links & Resources

Website

Included in

Ruby14.1k
Auto-fetched 5 hours ago

Related Projects

LiquidLiquid

Liquid markup language. Safe, customer facing template language for flexible web apps.

Stars11,841
Forks1,539
Last commit18 days ago
SlimSlim

Slim is a template language whose goal is to reduce the syntax to the essential parts without becoming cryptic.

Stars5,370
Forks497
Last commit2 months ago
MustacheMustache

Logic-less Ruby templates.

Stars3,082
Forks273
Last commit4 months ago
TiltTilt

Generic interface to multiple Ruby template engines

Stars1,939
Forks226
Last commit2 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub