Created
March 25, 2012 08:39
-
-
Save them0nk/2192411 to your computer and use it in GitHub Desktop.
haml cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!! 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