Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
haml cheatsheet
!!! strict
!!! XML
-# Self closing tags
%img{:src => "happy.jpg"}/
%table#mytableid{:class => "aclass"}
%table.aclass{:id => 'mytableid'}
%table{:id => 'mytableid', :class => "aclass"}
-# This line is a ruby comment
-# The Next line is a ruby statement which will not get printed
- @array = [1,2,3]
- @myclass = "highlight"
- @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