Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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