Skip to content

Instantly share code, notes, and snippets.

@them0nk
Created March 25, 2012 08:39
Show Gist options
  • Save them0nk/2192411 to your computer and use it in GitHub Desktop.
Save them0nk/2192411 to your computer and use it in GitHub Desktop.
haml cheatsheet
!!! strict
!!! XML
%html
-# Self closing tags
%img{:src => "happy.jpg"}/
%div.myclass
.myclass1
%div#myid.myclass
.myclass#myid
#myid.myclass
%table.aclass#mytableid
%table#mytableid{:class => "aclass"}
%table.aclass{:id => 'mytableid'}
%table{:id => 'mytableid', :class => "aclass"}
.myclass1.myclass2
.myclass2.myclass1
-# This line is a ruby comment
-# The Next line is a ruby statement which will not get printed
- @array = [1,2,3]
- @myclass = "highlight"
%ul
- @array.each do |e|
-# Below all syntax are equivalent
%li{:class => @myclass, :id => e }
= e
%li {:class => @myclass, :id => e} #{e}
%li= e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment