Generated by GPT-5-mini| Haml | |
|---|---|
| Name | Haml |
| Paradigm | Declarative, template |
| Designer | Devon Akmon, Hampton Catlin |
| Developer | Hampton Catlin, Chris Eppstein |
| First appeared | 2006 |
| Typing | N/A |
| Influenced by | HTML, Ruby (programming language), Sass (stylesheet language), ERB |
| License | MIT License |
Haml Haml is a templating language for producing HTML that emphasizes indentation and minimal syntax. It was created to streamline view generation in Ruby on Rails, influenced by Sass (stylesheet language), Slim (template engine), and ERB, and has been used alongside frameworks and tools such as Sinatra (web framework), Middleman (static site generator), Jekyll, and Nanoc (static site generator). Implementations and ports exist across ecosystems including Node.js, Python (programming language), PHP, and Java.
Haml originated in 2006, attributed to developers including Hampton Catlin and Devon Akmon, emerging contemporaneously with template systems like ERB, Liquid (template language), Smarty (template engine), and Jinja (template engine). Early adoption clustered around Ruby on Rails projects and communities such as GitHub, RubyGems, and conferences like RailsConf and RubyConf. Over time Haml influenced and was influenced by languages and tools such as Sass (stylesheet language), Slim (template engine), Mustache (logic-less template), and Handlebars.js, as web development practices shifted toward client-side frameworks like AngularJS, React (JavaScript library), and Vue.js.
Haml’s design emphasized readability and DRY principles familiar to users of Ruby (programming language), YAML, Python (programming language), and Sass (stylesheet language). The syntax uses indentation rather than explicit closing tags, resembling syntaxes used in Haml-influenced tools and in languages created by authors associated with projects like Hampton Catlin and contributors active on platforms such as GitHub and Stack Overflow. Typical constructs map to HTML elements, attributes, and content while integrating with Ruby code, helpers from ActionView (Rails), and template conventions found in ERB and Slim (template engine). Haml supports shorthand for classes and IDs inspired by CSS selectors conventions popularized alongside Bootstrap (front-end framework) and Foundation (framework).
Haml implementations exist in multiple languages: the reference Ruby implementation integrates with Ruby on Rails, Rack, and Sinatra (web framework), while ports and adapters target Node.js, Python (programming language), PHP, and Java, often appearing in ecosystems like npm, PyPI, Packagist, and Maven Central Repository. Usage patterns include server-side view rendering in Ruby on Rails applications, static site generation with Middleman (static site generator), and embedding within content management systems comparable to WordPress. Tooling support has been provided by editors and IDEs including Vim, Emacs, Visual Studio Code, and Sublime Text, with community packages and plugins distributed via GitHub and package registries.
Haml offers features such as implicit tag nesting, shorthand class and ID notation, attribute interpolation, and integration with Ruby helpers from ActionView (Rails) and libraries like ActiveSupport. Extensions and related projects include engines and compilers that transpile to HTML, integrations with asset pipelines like Sprockets, preprocessors influenced by Sass (stylesheet language), and alternative template engines such as Slim (template engine), Liquid (template language), and Mustache (logic-less template). Community-developed plugins often target interoperability with web frameworks like Sinatra (web framework), static site tools like Jekyll and Middleman (static site generator), and deployment platforms such as Heroku and Netlify.
Adoption peaked among Ruby on Rails developers, contributors on GitHub, and maintainers of projects using RubyGems and Bundler. Haml is often compared to engines like ERB, Slim (template engine), Liquid (template language), Mustache (logic-less template), and client-side approaches exemplified by React (JavaScript library) and AngularJS. Critics point to whitespace sensitivity issues similar to debates around Python (programming language) and YAML, performance considerations when compared to minimal engines like ERB, and challenges integrating with tooling in polyglot stacks involving Node.js and Java. Proponents highlight readability gains reminiscent of Sass (stylesheet language) and reduced boilerplate used in projects maintained on platforms such as GitHub and showcased at conferences like RailsConf.
Category:Template engines