Snelle referentie

Haml spiekbriefje

Snelle referentiegids voor Haml: doctypes, tags, klassen, ID's, inline HTML-attributen, Ruby-evaluatie en inspringregels.

· Gepubliceerd

Haml is een template-engine voor HTML die inspringing met witruimte gebruikt voor schone, herhalingsvrije (DRY) opmaak.

Basisprincipes

Doctype

!!!
!!! 5
!!! Strict
!!! Frameset
!!! Mobile
!!! Basic

Tags & Structuur

%p Hello World
%span
  Inner text

Klassen & ID's

%div#content
  %p.highlighted Text content

/ Div is the default tag when omitted
.notice
  #login-box

Inline attributen

Beide hash-syntaxen worden ondersteund:

%html{ "xml:lang" => "en", :lang => "en" }
%a{ :href => "/login", :title => "Sign in" }

/ HTML-style attributes syntax
%a(href="/login" title="Sign in")

Ruby-evaluatie

= "Evaluated Ruby expression"
- [1, 2, 3].each do |num|
  %li= num

Referenties

Verwante onderwerpen