1
0
mirror of https://github.com/onkelbeh/cheatsheets.git synced 2025-10-16 07:28:25 +02:00
cheatsheets/haml.md
Rico Sta. Cruz 511de900ba
Formatting updates (#2133)
- Update some sheets which have very long sections
- Remove `layout: 2017/sheet` (everything has the same layout now)
- Remove outdated sheets
2024-04-03 18:30:24 +11:00

696 B

title, category, prism_languages
title category prism_languages
Haml Markup
haml

Doctype

!!! 5

Tags

%html
  %head
    %title
  %body
    %h1 Hello World
    %br/

Classes and ID's

%p.class-example
.no-tag-defaults-to-div
%div#butItCanBeIncluded

Inline Attributes

Either hash syntax works

%meta{ name: "viewport", content: "width=device-width, initial-scale=1.0" }
%input{ :type => "text", :required => true }

Ruby

-# This is a comment
-# Anything starting with a hyphen signals to Haml that Ruby is coming
- @arr = [1, 2, 3]
- @str = "test"
-# Equal signals output
= render partial: "shared/header"
= yield
= link_to page_url